summaryrefslogtreecommitdiffstats
path: root/Java/Snack.java
blob: e1511c7fe8280ad4f2bb418e8ca57c26f151ad91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
//BufferedReader is faster than scanner as it doesn't parse the text. Iterated over 1000 times, it saves 30 seconds in total.
import java.io.BufferedReader;
import java.io.InputStreamReader;

class snacks {
    public static void main(String[] args) throws java.io.IOException {
		    BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
		    String snack;
		    System.out.println("Favorite food?");
		    snack = read.readLine(); 
		    System.out.println(snack + " sounds delicious!");
    }
}