Read from file and display in console

// IO Streams
// File handling
// Read from file and display in console
 
import java.io.*;
 
class FileDisplay
{
     public static void main(String as[]) throws IOException
     {
         
          FileInputStream fin = new FileInputStream(“opt.txt”);
         
          while(true)
          {
              int i = fin.read();
              if(i==-1)
                   break;
              System.out.print((char)i);                       
          }
             
          fin.close();
     }
}