/* * HiBill.java * * Created on January 10, 2007, 12:44 PM * * Checks to see if Bill Gates is running the program * Checks to see if the user is Bill Gates. Uses Scanner.nextLine and * if - else construct */ /** * * @author aharris */ import java.util.Scanner; public class HiBill { public static void main(String args[]){ Scanner input = new Scanner(System.in); System.out.println("What is your name? "); String userName = input.nextLine(); if (userName.equals("Bill Gates")){ System.out.println("Why are you using Java?"); } else { System.out.println("Nice to meet you, " + userName); } // end if } // end main } // end class