Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. try {
  2. Scanner input = new Scanner(System.in);
  3. System.out.print("Enter the file name with extention : ");
  4. File file = new File(input.nextLine());
  5.  
  6. input = new Scanner(file);
  7.  
  8.  
  9. while (input.hasNextLine()) {
  10. String line = input.nextLine();
  11. System.out.println(line);
  12. }
  13. input.close();
  14.  
  15. } catch (Exception ex) {
  16. ex.printStackTrace();
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement