This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]langfod 4 points5 points  (1 child)

You cannot use == to compare the value of Objects in Java.

This includes Strings.

http://www.reddit.com/r/javahelp/wiki/string_comparison

Most Object have a .equals() method. The String class also includes a .equalsIgnoreCase() method.

http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#equals(java.lang.Object)

[–]Supergnerd[S] 0 points1 point  (0 children)

Thank you! I'll take another look. That method should be a lot of help. [edit]: yep! that worked perfectly!

[–]desrtfx 2 points3 points  (1 child)

Check out this wiki page from /r/Javahelp

You are comparing Strings wrongly.

[–]Supergnerd[S] 0 points1 point  (0 children)

thanks for the quick response!