// This program demonstrates the use of the equals method for String // comparison. Testing if (response == expected) did not work. import java.util.*; public class SayCheese { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print("Say cheese: "); String expected = "cheese"; String response = console.next(); if (response.equals(expected)) { System.out.println("you did good...you get a cookie"); } else { System.out.println("no cookie for you...you said: " + response); } } }