// CSE 142, Helene Martin // Prints a message based on the user's name and Internet memes. import java.util.*; public class StringComparison { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print("Your name? "); String name = console.nextLine(); int stuff = 12; String candidate = "Mitt Romney"; // if (name == candidate) { -- ALWAYS false // to see why, use the jGRASP debugger and notice that candidate and name // are different objects. They have the same value, but that's not what // == compares. We need comparison methods to compare objects' values. if (name.equals(candidate)) { System.out.println("Show me your binder full of women!!"); } else if (name.equalsIgnoreCase("Barack Obama")) { System.out.println("You didn't build that!"); } else if (name.endsWith("Gore")) { System.out.println("Where's your lock box?"); } } }