import java.io.*;
class FileReaderFileWriter
{
public static void main(String[] args)
{
String file = "test.txt"; //name of the text file
String text = null;
System.out.println("Content of the file: ");
try
{
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
while ((text = bufferedReader.readLine()) != null)
{
System.out.println(text);
}
bufferedReader.close();
}
catch (FileNotFoundException ex)
{
ex.printStackTrace();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
}