for using the Scanner class, don't you need to make an import of the class?
import java.util.Scanner;
concerning your second question: the == and != are indeed not the right way to check whether two Strings are equal or not.
a String is an Object, and should be compared using the method equals() (or, equalsIgnoreCase())
for instance:
String guess = "guess";
String secret = "secret";
boolean test = guess.equals(secret);
// test = false;
if(!guess.equals(secret))
System.out.println("this line will be printed, since the two Strings are not equal");
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433