What is wrong here?

import java.util.Scanner;

class Question {

public static void main(String args[]) {

Scanner myScanner = new Scanner(System.in);

String vee;

System.out.print("Are you short? (Yes/No)");

vee = myScanner.next();

if (vee == "Yes" || vee == "yes") {

System.out.print("You must be Andy then!");

}

else {

System.out.print("Nevermind!");

}

}

}

That is my code. and here is the result

Are you short? (Yes/No)Yes

Nevermind!

Process completed.

How come it cant detect the Yes word? Please Help

[604 byte] By [Ackza] at [2007-11-27 2:34:23]
# 1
vee == "Yes" || vee == "yes""==" tests for object identity. It's true only if "yes" and vee points to the same object.You should try "yes".equalsIgnoreCase(vee)Budyanto
Budyanto.Himawana at 2007-7-12 2:51:46 > top of Java-index,Java Essentials,New To Java...
# 2
How would i put "yes".equalsIgnoreCase(vee); in the code for it to work?
Ackza at 2007-7-12 2:51:46 > top of Java-index,Java Essentials,New To Java...
# 3
Exactly the way you see it.if ("yes".equalsIgnoreCase(vee)) {}"yes" is a String object.It's really the same asif (vee.equalsIgnoreCase("yes")) {}Budyanto
Budyanto.Himawana at 2007-7-12 2:51:46 > top of Java-index,Java Essentials,New To Java...
# 4
OOOO got it Thank.Message was edited by: Ackz
Ackza at 2007-7-12 2:51:46 > top of Java-index,Java Essentials,New To Java...