-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab6NestedSwitch.java
More file actions
39 lines (36 loc) · 929 Bytes
/
Lab6NestedSwitch.java
File metadata and controls
39 lines (36 loc) · 929 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
36
37
38
39
package JavaLab;
import java.util.Scanner;
public class Lab6NestedSwitch {
public static void main(String[] args){
//input
Scanner s = new Scanner(System.in);
System.out.println("1. Separate Information\n2. Combined Information");
System.out.println("\nEnter a position to display information(1/2): ");
int val1 = s.nextInt();
switch(val1)
//switched option 1.
{
case 1:
System.out.println("1. Name\n2. Phone No.");
System.out.println("Enter your choice(1/2)");
int val2 = s.nextInt();
switch(val2)
{
case 1:
System.out.println("Name : Sanjay khatri");
break;
case 2:
System.out.println("Phone No. : 9861494803");
break;
default:
System.out.println("Invalid input");
}
break;
case 2:
System.out.println("Name: Sanjay khatri \n Phone Number : 9861494803");
break;
default:
System.out.println("Invalid input");
}
}
}