Reading file content in Java with single line of code

Views: 150   

This post shows you, how you can read a Files content into a String using one line of code in Java.
Following is the code using which you can load the file content into a String

String content = new String(Files.readAllBytes(Paths.get("/path/to/file.txt")));
On By