Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

whats the difference between == and .equal ?

Answer Posted / qim2010

The == returns true, if the variable reference points to the
same object in memory. This is a “shallow comparison”.

The equals() - returns the results of running the equals()
method of a user supplied class, which compares the
attribute values. The equals() method provides “deep
comparison” by checking if two objects are logically equal
as opposed to the shallow comparison provided by the
operator ==. If equals() method does not exist in a user
supplied class then the inherited Object class's equals()
method is run which evaluates if the references point to the
same object in memory. The object.equals() works
just like the "==" operator (i.e shallow comparison).
Overriding the Object class may seem simple but there are
many ways to get it wrong, and consequence can be
unpredictable behavior.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is api data?

1050


Can a class have 2 constructors?

959


Write a program to find the whether a number is an Armstrong number or not?

1073


What do you mean by scope of variable?

938


What ide should I use for java?

1089


What is Java Reflection API? Why it’s so important to have?

1241


How does multithreading take place on a computer with a single cpu in java programming?

1058


State one difference between a template class and class template.

1109


When do I need to use reflection feature in java?

1136


Can we override the static methods?

1084


Can we declare main () method as non static?

1035


What is difference between printf and scanf?

1227


What is the internal implementation of set in java?

986


Explain about fail fast iterators in java?

1116


What kind of variables can a class consist?

1100