-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExample2.java
More file actions
33 lines (27 loc) · 986 Bytes
/
Example2.java
File metadata and controls
33 lines (27 loc) · 986 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
package whileGita;
import java.awt.*;
import java.util.Scanner;
public class Example2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Label: while (true) {
System.out.println("1. Start Game");
System.out.println("2. Lead board");
System.out.println("3. About");
System.out.println("4. Exit");
System.out.print("Select menu, please: ");
int input = scanner.nextInt();
switch (input) {
case 1 -> {
System.out.println("Start game");
break Label;
}
case 2 -> System.out.println("Lead board");
case 3 -> System.out.println("About");
case 4 -> System.out.println("Exit game");
default -> System.out.println("Qayta urinib ko'ring");
}
}
System.out.println("Keyingi qadam");
}
}