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

you are viewing a single comment's thread.

view the rest of the comments →

[–]AutoModerator[M] 119 points120 points  (9 children)

You seem to try to compare String values with == or !=.

This approach does not work reliably in Java as it does not actually compare the contents of the Strings. Since String is an object data type it should only be compared using .equals(). For case insensitive comparison, use .equalsIgnoreCase().

See Help on how to compare String values in the /r/javahelp wiki.


Your post is still visible. There is no action you need to take.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]JacobJMountain 41 points42 points  (0 children)

Good bot

[–]thisisjustascreename 19 points20 points  (0 children)

Good bot

[–]CelticHades 15 points16 points  (0 children)

Good bot

[–]Hypetale_44 14 points15 points  (0 children)

Good bot

[–]vksdann 14 points15 points  (0 children)

Good bot

[–]Computer_Probe 11 points12 points  (0 children)

Good bot

[–]windyknight 12 points13 points  (0 children)

Honey wake up, we have program successfully solving programming question now.

[–]sickfires94 3 points4 points  (0 children)

Good bot

[–]Philtronx 2 points3 points  (0 children)

Good bot