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
Related Tutorial and Articles

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.