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 assembly condition codes?
Can we write class inside a class in java?
What does the “static” keyword mean?
How to avoid memory leak in java?
Can a method be overloaded based on different return type but same argument type?
Do I need java for windows 10?
What does indexof mean?
Discuss different types of errors that generally occur while programming.
What happens if we override only equals?
What is the use of default method in interface in java? Explain
String class is defined under which package in java?
What is not thread safe?
Are functions objects in java?
What is integer parseint?
Which package is always imported by default?