Advertisement
willieshi232

Untitled

Nov 18th, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. 12.
  2. input: 6.7 This file has
  3. input: several input lines.
  4. input:
  5. input: 10 20 30 40
  6. input:
  7. input: test
  8. 6 total
  9. 14a.
  10. 0 total
  11. 14b.
  12. input: 6.7
  13. 1 total
  14. 16.
  15. import java.io.*;
  16. import java.util.*;
  17. public class printEntireFile
  18. {
  19. public static void main(String [] args)
  20. throws FileNotFoundException
  21. {
  22. Scanner pikachu = new Scanner(System.in);
  23. System.out.print("Input your file name");
  24. String file = pikachu.next();
  25. Scanner input = new Scanner(new File("file");
  26. while(input.hasNextLine())
  27. {
  28. System.out.println(input.nextLine());
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement