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 treemap in java?
What is java autoboxing?
Explain the difference between jdk, jre, and jvm?
What is the difference between choice and list?
Why is java so important?
Why is method overloading not possible by changing the return type in java?
How many functional interfaces does java 8 have?
what is session in java?
How many techniques can be employed to create a string object?
does java support pointers?
What are default methods ?
In the below example, how many string objects are created?
List some java keywords sun like c, c + + keywords?
Can we extend a class with private constructor?
List out benefits of object oriented programming language?