123456789101112131415161718192021222324252627
  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 scan = new Scanner(System.in);
  8. while (true) {
  9. System.out.println("Enter Name: ");
  10. String name = scan.nextLine();
  11. aliceOrBob(name);
  12. if (name.equals("Bob"))break;
  13. if (name.equals("Alice"))break;
  14. }
  15. }
  16. public static void aliceOrBob(String name){
  17. String message = name.equals("Alice") || name.equals("Bob") ?
  18. ("Hello: " + name) : ("Try a new name");
  19. System.out.println(message);
  20. }
  21. }