//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!"); } }