using equals method overriding which objects are
compared?i.e same class objects or other class
objects?Explain me.
Answer Posted / 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 |
Post New Answer View All Answers
What is maximum size of arraylist in java?
Why is whitespace important?
how do I create a runnable with inheritance? : Java thread
What is a newline character in java?
Why is the main method static?
Difference between start() and run() method of thread class?
What does split function do in java?
What is bitwise complement?
What is binary search in java?
What is this keyword in java?
what is the difference between thread and runnable types? : Java thread
What is default switch case? Give example.
Can abstract class have private constructor?
What does indexof mean?
Why Set interface contains unique elements, what internally implemented for this so that it contains unique elements?