Advertisement
Gauge1417

Untitled

Mar 3rd, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import java.io.File;
  2. import java.util.Scanner;
  3.  
  4. public class Program {
  5.  
  6. public static void main(String[] args) {
  7.  
  8.  
  9. File f = new File("Cookie.txt");
  10.  
  11. try {
  12. Scanner sc = new Scanner(f);
  13. while (sc.hasNextLine()) {
  14. String fortune = sc.nextLine();
  15. if(fortune.charAt(fortune.length()-1)== '.')
  16. System.out.println (fortune);
  17. else
  18. System.out.println(fortune + ".");
  19. }
  20. }
  21. catch(Exception e) {
  22. System.out.println (":");
  23. }
  24.  
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement