This post originated from an RSS feed registered with Java Buzz
by Michael Cote.
Original Post: Ye Olde == vs. Equals, with Strings
Feed Title: Cote's Weblog: Coding, Austin, etc.
Feed URL: https://cote.io/feed/
Feed Description: Using Java to get to the ideal state.
In this tip you saw that the only safe way to test that Strings have the same value is with the equals() method. If you work with Strings that have the same value, then it might be worth interning them into the constants pool. That way you can make a quicker check using the == operator. In any case, you can see that you have to be careful before deciding to use == to check equivalence.
This months Sun's Java-spam (or whatever it's called) has an article on == and .equals for String. Here's a tip: if you're going to be interviewing for a job, read this and understand it.