Possible Duplicate:
How do I compare strings in Java?
I have this code:
System.out.println(staff.getEmail().length());
System.out.println(staff.getEmailList());
if ((staff.getEmail().length() > 0) && (staff.getEmailList() == "Y")) {
System.out.println(staff.getEmail());
This is the output on my eclipse console:
12
Y
My problem is that even though both conditions in the if statement are satisfied, my program can never get to the last line of code above (System.out.println(staff.getEmail())). I don't any error too.
Any ideas what could I've done wrong? thanks :)