Assignment 127

Code

    import java.io.File;
    import java.util.Scanner;
    class open
    {
        public static void main (String [] args) throws Exception
        {
            Scanner kb = new Scanner(System.in);
            System.out.println("Which file you want: ");
            String imput = kb.next();
            
            Scanner fileIn = new Scanner(new File((String) imput));
            
            
                while (fileIn.hasNext())
                {
                    String print = fileIn.nextLine();
                    System.out.println(print);
                }
                fileIn.close();
         }
    }
    

Picture of the output

Assignment