-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitchstatement.java
40 lines (30 loc) · 975 Bytes
/
switchstatement.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
29
30
31
32
33
34
35
36
37
38
39
40
/**
* @author arieldanon
* @version 15 Feb 2024
* This program will demonstrate the switch statement
*/
import java.util.Scanner;
public class switchstatement {
public static void main(String[] args) {
// create an instance of the scanner
Scanner input = new Scanner(System.in);
// prompt the user
System.out.print("Enter in case A, B, or C: ");
// declare string variable and get user input
String x = input.nextLine();
// declare our switch statement
switch (x){
case "A":
System.out.println("You have chosen case A");
break;
case "B":
System.out.println("You chose case B... wow");
break;
case "C":
System.out.println("Case C is badaccss");
break;
default:
System.out.println("You chose poorly you lil weirdo");
}
}
}