what is the difference between equals method and ==

Answer Posted / r ramya

== checks the string value
equals for checking the strinhg object
String s1="hai";
String s2=new String("hai");
sop(s1==s2);//false
sop(s1.equals(s2));//true

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the exact difference in between unicast and multicast object? Where we will use?

566


What is the purpose of extern variable?

547


Program to Find the second largest element in an array.

593


What are parsing rules?

509


Why arraylist is not synchronized in java example?

477






Why hashmap is used in java?

560


What is method overloading in java ?

566


What does localhost mean?

506


Can a static block throw exception?

666


What is a numeric string?

572


What is the difference between post and put?

544


What is a flag value?

523


what is bmg file and how to create that files?what will it contailn?

1902


Does sprintf allocate memory?

603


What is command line used for?

602