What method is used to compare two strings ?

Answer Posted / suman

The == operator works on String object references. If two
String variables point to the same object in memory, the
comparison returns a true result.

The equals method compares the actual char content of two
strings. This method returns true when two String objects
hold char data with the same values.

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How finally used under exception handling?

727


Which collection is ordered in java?

749


What is string made of?

741


Explain wait() method of object class ?

895


How many bytes is a url?

766


What is the Scope of Static Variable?

967


What is assembly condition codes?

772


What does the three dot emoji mean?

827


Is math an abstract class in java?

734


What is literal example?

735


What is the benefit of inner classes in java?

859


How to display arraylist values in java?

737


How do I get 64 bit java?

728


Define immutable object?

853


What is the new line character?

844