Q:

Java - Read the Text File

0

This Program is used to Read the text from the given File.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

// Read the File



import java.io.*;

public class test9a

 {

  public static void main(String arg[])

     {

       try

        {

          FileReader fr = new FileReader("abc.txt");

          BufferedReader br = new BufferedReader(fr); 

          String str;

          while( (str = br.readLine()) != null)

             {  

                System.out.println("\n"+str+"\n");    

              }

         br.close();          

         fr.close();

          }

         catch(Exception e)

         { 

             System.out.println("Error...");           

         }

       }

   }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now