BlackBerry Interview Question

Difference between .equals and ==

Interview Answer

Anonymous

Jun 9, 2011

.equals is a method used for objects or strings, it will compare the contents and return true or false. For Strings it will check character by character. == is an operator and in the case of Strings or Objects, will check for their reference in memory. It will return false, even when two Strings are the same, but if they have been instantiated with the new keyword