Main.java 595B

1234567891011121314151617181920212223
  1. /**
  2. * Created by iyasuwatts on 10/17/17.
  3. */
  4. import java.util.Scanner;
  5. public class Main {
  6. public static void main(String[] args ){
  7. Scanner scanner = new Scanner(System.in);
  8. while (true) {
  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 + "!");
  13. break;
  14. } else {
  15. System.out.println("You're not Alice or Bob!");
  16. }
  17. }
  18. }
  19. }