AliceandBob.java 561B

123456789101112131415161718192021222324252627
  1. import java.util.*;
  2. /**
  3. * Created by iyasuwatts on 10/17/17.
  4. */
  5. public class AliceandBob {
  6. public static void main(String[] args ){
  7. }
  8. public void greeting() {
  9. Scanner input = new Scanner(System.in);
  10. System.out.println("What is your name?");
  11. String name = input.nextLine();
  12. if (name.equals("Alice")) {
  13. System.out.println("Hi Alice!");
  14. } else if (name.equals("Bob")) {
  15. System.out.println("Hi Bob!");
  16. } else {
  17. System.out.println("Get Out!");
  18. }
  19. }
  20. }