Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. package po2.td2;
  2. import java.io.*;
  3. import java.util.Scanner;
  4.  
  5. /**
  6. * @author J.-F. Remm
  7. * @version 1
  8. */
  9. public class Lecture {
  10.  
  11.  
  12. private static double getDouble()
  13. {
  14. return 0.0;
  15. }
  16.  
  17.  
  18.  
  19. public static void main(String[] args) {
  20.  
  21. String nom;
  22. System.out.print("Chemin :");
  23. Scanner sc = new Scanner(System.in);
  24. nom = sc.next();
  25. Scanner scan = null;
  26.  
  27. try {
  28. scan = new Scanner(new File(nom));
  29. while(scan.hasNext()) {
  30. System.out.println(scan.next());
  31. }
  32.  
  33. }
  34. catch(FileNotFoundException e){
  35. System.out.println(e.getMessage() + " ");
  36. }
  37.  
  38. finally {
  39. sc.close();
  40. scan.close();
  41. }
  42.  
  43.  
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement