Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class PassFail {
- private static Scanner input;
- public static void main(String[] args) {
- try {
- input = new Scanner(System.in);
- System.out.print("Enter the file name with extention : ");
- File file = new File(input.nextLine());
- input = new Scanner(file);
- while (input.hasNextLine()) {
- String line = input.nextLine();
- System.out.println(line);
- }
- } catch (FileNotFoundException e) {
- System.out.println("File not found");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement