- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitchExample.java
More file actions
Latest commit
22 lines (20 loc) · 629 Bytes
/
Copy pathSwitchExample.java
File metadata and controls
22 lines (20 loc) · 629 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
packagecom.company;
importjava.util.Scanner;
publicclassSwitchExample {
publicstaticvoidmain(String[] args) {
Scannersc=newScanner(System.in);
System.out.println("Enter Your Number : ");
intnum=sc.nextInt();
switch (num)
{
case10: System.out.println("10");
break;
case20: System.out.println("20");
break;
case30: System.out.println("30");
break;
//Default case statement
default:System.out.println("Not in 10, 20 or 30");
}
}
}