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

7 years ago by

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