   import java.util.Scanner;
   import java.io.*;
    public class ReadFromFile6   
	 {
       public static void main (String [] args) 
		 {
         String fileName;
         Scanner fileScanner;
         Scanner keyboard;
         int value;
      
         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);
         
         try
			{ 
           fileScanner = new Scanner (new File (fileName));
            while (fileScanner.hasNextInt()) 
            {
               value = fileScanner.nextInt();
               System.out.println (" The value you got from the file is " + value);
            }
         }  
         
			catch (ArrayIndexOutOfBoundsException  aioobe)
			{
			   System.out.println ("Array index went out of bounds ");
			}
         catch (FileNotFoundException fnfe)
			{
			   System.out.println (" The file you wanted to open was not found ");
	      }
      } // end main
   } // end class 