12345678910111213141516171819202122232425262728 |
- /**
- * Created by iyasuwatts on 10/17/17.
- */
- import java.util.Scanner;
- public class Main {
-
- public static void main(String[] args ){
- Scanner input = new Scanner(System.in);
- //prompt the user to enter name
- System.out.println(" Please Enter your Name:");
-
- String name;
- name=input.next();
- // if statement to output a greatting to Allice
- if ( name.equals("Alice")){
- System.out.println("Welcome" + name +" to the world of Java" );
- }
-
- // gretting stament for Bob
- else if (name.equals("Bob")) {
- System.out.println("welcome" + name+ "to the world of Java");}
- // if the name is not Alice or Bob
- else {
- System.out.println("Sorry, you dont belong here!");
- }
- }
- }
|