-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrimDemo.java
More file actions
24 lines (17 loc) · 478 Bytes
/
TrimDemo.java
File metadata and controls
24 lines (17 loc) · 478 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
package ch18.stringprocessing;
import java.util.*;
public class TrimDemo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input;
do {
System.out.println("Enter the name of the country");
input = sc.next();
if (input.equals("US"))
System.out.println("Washington DC");
else if (input.equals("Canada"))
System.out.println("Ottawa");
} while (!input.equals("stop"));
System.out.println("Terminated!");
}
}