Home Tutorialhelp Comment Example: Diff Between .equals() and ==

 
 

Comment

leela
Example: Diff Between .equals() and ==,
March 18, 2008 at 6:04 PM

String str1 = new String("Hi");
String str2 = new String("Hi");
System.out.println(str1 == str2); //false
System.out.println(str1.equals(str2)); //true
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Advertisements Advertisements
 

 

 

DMCA.com