Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.IOException;
- import java.util.Scanner;
- public class Question4
- {
- public static void main(String[] args) throws IOException
- {
- Scanner keyboard = new Scanner(System.in);
- System.out.println("Enter filename");
- String filename = keyboard.nextLine();
- File test1 = new File("test1.txt");
- Scanner inputFile = new Scanner(test1);
- while (inputFile.hasNext())
- {
- String file = inputFile.nextLine();
- System.out.println(file);
- }
- inputFile.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement