alpe's program to read a txt file.

alpe gulay 0 Tallied Votes 292 Views Share

.,'this is a simple java codes in w/c will enable to read a txt files.

import java.io.*;
public class file
{
    public static void main (String []args) throws IOException
    {
    String out="";
          BufferedReader in = new BufferedReader(new FileReader("file.java"));
        String str;
        while ((str = in.readLine()) != null)
         {
            out+=str+"\n";
        }
        in.close();
        System.out.print(out);
    }
}