Java BufferedReader create from FileReader
import java.io.BufferedReader; import java.io.FileReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new FileReader("Main.java")); String s, s2 = new String(); while ((s = in.readLine()) != null) s2 += s + "\n"; System.out.println(s2);/*from w w w . j av a 2s . c o m*/ in.close(); } }