|
@@ -6,11 +6,17 @@ public class Main {
|
6
|
6
|
|
7
|
7
|
public static void main(String[] args ){
|
8
|
8
|
Scanner scanner = new Scanner(System.in);
|
9
|
|
- System.out.println("What is your name?");
|
10
|
|
- String name = scanner.nextLine();
|
11
|
|
- if (name.equals("Alice") || name.equals("Bob")) {
|
12
|
|
- System.out.println("Hello " + name + "!");
|
|
9
|
+
|
|
10
|
+ while (true) {
|
|
11
|
+
|
|
12
|
+ System.out.println("What is your name?");
|
|
13
|
+ String name = scanner.nextLine();
|
|
14
|
+ if (name.equals("Alice") || name.equals("Bob")) {
|
|
15
|
+ System.out.println("Hello " + name + "!");
|
|
16
|
+ break;
|
|
17
|
+ } else {
|
|
18
|
+ System.out.println("You're not Alice or Bob!");
|
|
19
|
+ }
|
13
|
20
|
}
|
14
|
|
-
|
15
|
21
|
}
|
16
|
22
|
}
|