import java.util.*; /** * This program will do the following: * Firstly ask the user to input his/her name. Then find a way to check the person's name to see if it is Bob or Alice. * If the user's name is either Alice or Bob; then a greeting will be printed to the screen. */ public class AliceAndBob { /* The Scanner class is used as a simple text scanner which can parse/analyze a sentence in parts. * In this case Scanner is used to scan the user's input to check for something specific. *System.out.print ("What is your name?"); ---> this prints "What is your name?" to the console and this prompts the user to input his/her name. * String name = in.nextLine---> this will print the entire line that that the user enters. */ public static void main(String[] args ){ Scanner in = new Scanner(System.in); System.out.print("What is your name?"); String name = in.nextLine(); //If the user's name is equivalent to Alice or Bob; then print "Hi!" if(name.equals("Alice") || name.equals("Bob")){ System.out.println("Hi!"); } } }