This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
What are the general rules governing the use of the == operator. I notice we cannot compare String == StringBuffer . Why is this. Do the objects on both sides have to be in some sort of hierarchy ? thanx
== usually compares two objects as pointing to the same reference. even if you had ... String a = new String("A"); String b = new String("A"); you should get false when you say... System.out.println(a == b);