   import java.util.Scanner;
   import java.io.*;
    public class ReadFromFile_2
   {
       public static void main (String [] args)
      {
         String fileName;
         Scanner fileScanner;
         Scanner keyboard;
         int value;
         File inputFile;
      	      
         keyboard = new Scanner (System.in);
         System.out.println (" Please enter name of file holding integers and hit return ");
         fileName = keyboard.nextLine();
      
         System.out.println
			 (" The name of the file you want to open is " + fileName);
         inputFile = new File (fileName); 
      	
         try
         {
            fileScanner = new Scanner (inputFile);
            while (fileScanner.hasNextInt()) 
            {
               value = fileScanner.nextInt();
               System.out.println (" The value you got from the file is " + value);
            }
         
         }
             catch (FileNotFoundException fnfe)
            {
               System.out.println (" The file you wanted to open could not be found ");  
            }
      } // end main
   } // end class