Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.util.Scanner;
  4.  
  5. public class PassFail {
  6.  
  7. private static Scanner input;
  8.  
  9. public static void main(String[] args) {
  10. try {
  11. input = new Scanner(System.in);
  12. System.out.print("Enter the file name with extention : ");
  13. File file = new File(input.nextLine());
  14. input = new Scanner(file);
  15. while (input.hasNextLine()) {
  16. String line = input.nextLine();
  17. System.out.println(line);
  18. }
  19.  
  20. } catch (FileNotFoundException e) {
  21. System.out.println("File not found");
  22.  
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement