-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSwitch_1.java
More file actions
24 lines (21 loc) · 973 Bytes
/
Copy pathSwitch_1.java
File metadata and controls
24 lines (21 loc) · 973 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
/*
author: Jaydatt Patel
Switch function : It will compare values with each 'case' and if match then flow control transferred to that 'case' and execution jump out of switch using 'break'. If we not use 'break' statement then will continue to execute rest of 'case' untill it found 'break'.
*/
class Switch_1 {
public static void main(String args[])
{
String ss = "fri";
switch(ss.toLowerCase())
{
case "sun":System.out.println("Sunday");break;
case "mon":System.out.println("Monday");break;
case "tue":System.out.println("Tuesday");break;
case "wed":System.out.println("Wednesday");break;
case "thur":System.out.println("Thursday");break;
case "fri":System.out.println("Friday");break;
case "sat":System.out.println("Saturday");break;
default:System.out.println("Invalid Input");break;
}
}
}