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

What is class and its types?

0 Answers  


What are the interfaces defined by Java.lang package?

1 Answers  


What is meant by bytecode?

0 Answers  


What is a java string?

0 Answers  


What is string manipulation?

0 Answers  






Why is logger singleton?

0 Answers  


How to check if a list is sorted in java?

0 Answers  


Is void a data type in java?

0 Answers  


String is a immutable objects . it means that string does not change........... But it will be chang......... { String s="kapil"; String s1="raj"; String s=s1; then print(.......) The String has been changed .. how it is possible and why its called immutable objects

7 Answers  


What are loops in java?

0 Answers  


What is scanner in java?

0 Answers  


Why char array is preferred over string for storing password?

0 Answers  


Categories