Posts

Showing posts from December 3, 2018

How do I compare strings in Java?

up vote 727 down vote favorite 917 I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug. Is == bad? When should it and should it not be used? What's the difference? java string equality share edited Jan 23 '13 at 13:36 community wiki Nathan H