-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBASICS21.java
28 lines (22 loc) · 888 Bytes
/
BASICS21.java
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
import java.util.Scanner;
public class BASICS21 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Button number: ");
int button = sc.nextInt();
// String result = switch (button) {
// case 1 -> "u had clicked button 1!"; // do not give default case at every case
// case 2 -> "u had clicked button 2!";
// default -> "none of the case matches";
// };
// System.out.println(result);
switch (button) {
case 1:
System.out.println("u had clicked button 1!");
case 2:
System.out.println("u had clicked button 2!"); // gives default case at every case
default:
System.out.println("none of the case matches");
}
}
}