- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswitchcases.java
More file actions
Latest commit
35 lines (27 loc) · 589 Bytes
/
Copy pathswitchcases.java
File metadata and controls
35 lines (27 loc) · 589 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
//this program shows use of switch case
publicclassswitchcases {
publicstaticvoidmain(String[] args) {
intnumber = 44;
Stringsize;
// switch statement to check size
switch (number) {
case29:
size = "Small";
break;
case42:
size = "Medium";
break;
// match the value of week
case44:
size = "Large";
break;
case48:
size = "Extra Large";
break;
default:
size = "Unknown";
break;
}
System.out.println("Size: " + size);
}
}