forked from ChrisMayfield/ThinkJavaCode2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEcho.java
More file actions
25 lines (19 loc) · 636 Bytes
/
Echo.java
File metadata and controls
25 lines (19 loc) · 636 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Scanner;
/**
* Inputs two lines and repeats them back to the user.
*/
public class Echo {
public static void main(String[] args) {
String line;
Scanner in = new Scanner(System.in);
System.out.print("Type something: ");
line = in.nextLine();
System.out.println("You said: " + line);
System.out.print("Type something else: ");
line = in.nextLine();
System.out.println("You then said: " + line);
System.out.print("One more time please: ");
line = in.nextLine();
System.out.println("I totally agree with " + line);
}
}