-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitchCase.java
More file actions
32 lines (27 loc) · 925 Bytes
/
SwitchCase.java
File metadata and controls
32 lines (27 loc) · 925 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
package start;
import java.util.Scanner;
public class SwitchCase {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Co chcesz zrobić :\n (1) Zadanie1 \n (2) Zadanie2 \n (3) Zadanie3 \n (0) Wyjście");
//klucz do instrukcji switch case
int key = scanner.nextInt();
switch (key){
case 1:
System.out.println("Rozwiązanie zadania 1");
break;
case 2:
case 5: // można miec dwie opcje
System.out.println("Rozwiązanie zadania 2");
break;
case 3:
System.out.println("Rozwiązanie zadania 3");
break;
case 0:
System.out.println("Wyjście");
break;
default:
System.out.println("Zły wybór!");
}
}
}