Does Java has a one line instruction to read to a text file, like what C# has?
I mean, is there something equivalent to this in Java?:
String data =
Not within the main Java libraries, but you can use Guava:
String data = Files.asCharSource(new File("path.txt"), Charsets.UTF_8).read();
Or to read lines:
List lines = Files.readLines( new File("path.txt"), Charsets.UTF_8 );
Of course I'm sure there are other 3rd party libraries which would make it similarly easy - I'm just most familiar with Guava.