package FilesInputOutput;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.JOptionPane;

public class ReadFile {
    public static void main(String[] args) {
              String data = new String();
              String report=new String();
               try{
	     FileReader  fileObj = new FileReader("Testing.txt");		   
	     BufferedReader buffer = new BufferedReader(fileObj);
	     while((data = buffer.readLine()) != null)
                            report+=data+"\r\n";
                            //System.out.println(data); 
                        buffer.close();
                        fileObj.close();
                        JOptionPane.showMessageDialog(null,report);
                }catch (FileNotFoundException evt){
                       JOptionPane.showMessageDialog(null, "File not found");
                }catch(IOException evt){
                      JOptionPane.showMessageDialog(null, "Reading failed");
                }
          }

    
}
