forked from CMPundhir/JavaExamples
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitchDemo.java
More file actions
Latest commit
20 lines (20 loc) · 547 Bytes
/
Copy pathSwitchDemo.java
File metadata and controls
20 lines (20 loc) · 547 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
importjava.util.Scanner;
classSwitchDemo{
publicstaticvoidmain(String[] args){
Scannersc = newScanner(System.in);
System.out.println("Enter a number : ");
inta = sc.nextInt();
Stringday = null;
switch(a){
case0: day = "Sunday";break;
case1: day = "Monday";break;
case2: day = "Tuesday";break;
case3: day = "Wednesday";break;
case4: day = "Thursday";break;
case5: day = "Friday";break;
case6: day = "Saturday";break;
default: day = "Error : wrong number input";
}
System.out.println(day);
}
}