Java tutorial
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class MainClass { public static void main(String[] args) throws IOException { // 1. Reading input by lines: BufferedReader in = new BufferedReader(new FileReader("IOStreamDemo.java")); String s, s2 = new String(); while ((s = in.readLine()) != null) s2 += s + "\n"; in.close(); } }