whats the difference between == and .equal ?

Answer Posted / deepak sharma

== compares the object refrences to see if they refer to the
same object in memory.

where as

.equals compares the content of object to see if the object
content is same. Most of the times it is used to compare the
String Object. It can be used to compare other Objects too.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why should I use abstract class?

570


Differentiate between array list and vector in java.

638


What is private protected in java?

550


Does java isempty check for null?

574


What is the difference between hashmap and hashtable? What is an interface?

508






Does java support multiple inheritances?

558


Can you explain the meaning of aggregation and composition

574


What is meant by object oriented programming – oop?

544


How do generics work?

520


What is the difference between && and & in java?

571


What does it mean to be immutable?

552


Write a program to check string is palindrome without using loop?

567


Differentiate jar and war files?

594


What is included in core java?

583


Why constructor has no return type?

638