OneCompiler

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

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