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

what are Hostile Applets?

1806


Is string is a class in java?

700


How does enum work in java?

782


What do you mean by order of precedence and associativity?

742


Can you instantiate the math class in Java?

809


What is difference between static class and singleton pattern?

687


Can you explain inner class.

823


What is object-oriented programming?

793


Explain about automatic type conversion in java?

828


Why is the main method static?

878


What is a singleton class? Give a practical example of its usage.

831


How many types of constructors are used in java?

795


what do you mean by java annotations?

781


Explain parallel processing in java8?

892


Why static functions are used?

793