Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.util.Scanner;
- public class Program {
- public static void main(String[] args) {
- File f = new File("Cookie.txt");
- try {
- Scanner sc = new Scanner(f);
- while (sc.hasNextLine()) {
- String fortune = sc.nextLine();
- if(fortune.charAt(fortune.length()-1)== '.')
- System.out.println (fortune);
- else
- System.out.println(fortune + ".");
- }
- }
- catch(Exception e) {
- System.out.println (":");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement