Email This Tutorial  
 

Java-Samples.com

equals( ) Versus == in Java
 
It is important to understand that the equals( ) method and the == operator perform two different operations. As just explained, the equals( ) method compares the characters inside a String object. The == operator compares two object references to see whether they refer to the same instance. The following program shows how two different String objects can contain the same characters, but references to these objects will not compare as equal:
 
 
 
Recipient's e-mail address * :

(Use commas to separate multiple e-mail addresses.)

Your e-mail address * :
Add your comments (optional) :
 
 
COPYRIGHTę 2006 java-samples.com. ALL RIGHTS RESERVED.