Main.java 805B

12345678910111213141516171819202122232425262728
  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 input = new Scanner(System.in);
  8. //prompt the user to enter name
  9. System.out.println(" Please Enter your Name:");
  10. String name;
  11. name=input.next();
  12. // if statement to output a greatting to Allice
  13. if ( name.equals("Alice")){
  14. System.out.println("Welcome" + name +" to the world of Java" );
  15. }
  16. // gretting stament for Bob
  17. else if (name.equals("Bob")) {
  18. System.out.println("welcome" + name+ "to the world of Java");}
  19. // if the name is not Alice or Bob
  20. else {
  21. System.out.println("Sorry, you dont belong here!");
  22. }
  23. }
  24. }