import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
 
public class Class1 {
 
public static void main(String[] args) {
 
  try
  {
  FileInputStream in = new FileInputStream("inputFile.txt");
  BufferedReader br = new BufferedReader(new InputStreamReader(in));
  String strLine;
 
  while((strLine = br.readLine())!= null)
  {
   System.out.println(strLine);
  }
 
  }catch(Exception e){
   System.out.println(e);
  }
 
 }
}
This code will output a file line by line (strLine) to the console.