Skip to content

Commit bd62e6f

Browse files
Switch Case Statements
1 parent 5ee4b23 commit bd62e6f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.company;
2+
import java.util.Scanner;
3+
4+
public class cwh_18_elseif {
5+
public static void main(String[] args) {
6+
String var = "Saurabh";
7+
8+
9+
switch (var) {
10+
case "Shubham" -> {
11+
System.out.println("You are going to become an Adult!");
12+
System.out.println("You are going to become an Adult!");
13+
System.out.println("You are going to become an Adult!");
14+
}
15+
case "Saurabh" -> System.out.println("You are going to join a Job!");
16+
case "Vishaka" -> System.out.println("You are going to get retired!");
17+
default -> System.out.println("Enjoy Your life!");
18+
}
19+
System.out.println("Thanks for using my Java Code!");
20+
21+
22+
/*
23+
int age;
24+
System.out.println("Enter Your Age");
25+
Scanner sc = new Scanner(System.in);
26+
age = sc.nextInt();
27+
if (age>56){
28+
System.out.println("You are experienced!");
29+
}
30+
else if(age>46){
31+
System.out.println("You are semi-experienced!");
32+
}
33+
else if(age>36){
34+
System.out.println("You are semi-semi-experienced!");
35+
}
36+
else{
37+
System.out.println("You are not experienced");
38+
}
39+
if(age>2){
40+
System.out.println("You are not a baby!");
41+
}
42+
*/
43+
44+
}
45+
}

0 commit comments

Comments
 (0)