-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoWhile_statement.java
35 lines (34 loc) · 1.08 KB
/
doWhile_statement.java
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
26
27
28
29
30
31
32
33
34
35
package src.controlStatements.whileStatements;
class doWhile_statement {
public static void main(String[] args) throws java.io.IOException {
char choice;
do {
System.out.println("Menu");
System.out.println("1. check");
System.out.println("2. check");
System.out.println("3. check");
System.out.println("4. check");
System.out.println("5. check");
System.out.print("Choose: ");
choice = (char) System.in.read();
} while(choice < '1' || choice > '5');
System.out.println();
switch(choice) {
case '1':
System.out.println("You selected 1");
break;
case '2':
System.out.println("You selected 2");
break;
case '3':
System.out.println("You selected 3");
break;
case '4':
System.out.println("You selected 4");
break;
case '5':
System.out.println("You selected 5");
break;
}
}
}