logo image

How to read a File content into String in Java?


How can i read the full content of a file into a String in Java?

1 Answer

2 years ago by

String fileContent = new String(Files.readAllBytes(Paths.get("/path/to/file.txt")));
2 years ago by Megamind