-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelp.java
More file actions
35 lines (32 loc) · 911 Bytes
/
Help.java
File metadata and controls
35 lines (32 loc) · 911 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
26
27
28
29
30
31
32
33
34
35
/*
Try This 3-1
*/
class Help {
public static void main(String args[]) throws java.io.IOException {
char choice;
System.out.println("Help on:");
System.out.println("\t1. if");
System.out.println("\t2. switch");
System.out.print("Choose one: ");
choice = (char) System.in.read();
System.out.println("\n");
switch(choice) {
case '1':
System.out.println("The if:\n");
System.out.println("if(condition) statement;");
System.out.println("else statement;");
break;
case '2':
System.out.println("The switch:\n");
System.out.println("switch(expression) {");
System.out.println("\tcase constant:");
System.out.println("\t\tstatement sequence");
System.out.println("\t\tbreak;");
System.out.println("\t// ...");
System.out.println("}");
break;
default:
System.out.println("Selection not found.");
}
}
}