using equals method overriding which objects are
compared?i.e same class objects or other class
objects?Explain me.

Answers were Sorted based on User's Feedback



using equals method overriding which objects are compared?i.e same class objects or other class ob..

Answer / kisu

if u r not sure then dont give that wrong answer..bcoz we r
suffering..and we won't chose which one is correct..so plz
plz give those answer which one is perfect ....

Is This Answer Correct ?    2 Yes 0 No

using equals method overriding which objects are compared?i.e same class objects or other class ob..

Answer / r.jainrocks@gmail.com

we compare with same class object...

let me know when u override equals() method
u code like--->

this.name.equals(obj.name);

so this comparison is with same class object not with
other class.....

if there is other class class object then
ClassCastException may occur due wrong casting...

so be careful while using equals method overriding....

Is This Answer Correct ?    2 Yes 0 No

using equals method overriding which objects are compared?i.e same class objects or other class ob..

Answer / mi2

Other class objects

Is This Answer Correct ?    1 Yes 1 No

using equals method overriding which objects are compared?i.e same class objects or other class ob..

Answer / bond

same class objects

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Core Java Interview Questions

Difference between association, composition and aggregation?

0 Answers  


What are the two basic ways in which classes that can be run as threads may be defined?

0 Answers  


Describe 2 different ways to concatenate two strings.

0 Answers   TCS,


What is data type in computer?

0 Answers  


what are literals in java?

2 Answers  






what is Thread?

6 Answers  


How do you sort data in java?

0 Answers  


Can an abstract class be a final class?

0 Answers  


What is bubble sorting in java?

0 Answers  


how can you retrive information from database by using hashmap/arraylist ,plz explain with example briefly?

1 Answers   Satyam,


What is the basic of java?

0 Answers  


What is the difference between heap and stack memory?

0 Answers  


Categories