How to read a File content into String in Java?

590


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

1 Answer

6 years ago by

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