why the equals method can be override?when we override the
equals method?
Answer Posted / madhu
equals() method will be available in primodian class that is
Object class, but by default it compares only the addresses,
not the contents, So if you want the content comparison you
have to override equals(), but if u override the equals(),
you have to override the hashCode() also.
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Can a method inside a interface be declared as final?
What is a nested list?
What is append function?
Which eclipse is best for java?
Explain the scope or life time of class variables or static variables?
Can final class have constructor?
Why pointers are not used in java?
What is map in java?
What is an empty string in css?
How hashset works internally in java?
What is a key in java?
Can a class extends itself in java?
What is pojo class in java?
What about interrupt() method of thread class ?
Difference between ‘is-a’ and ‘has-a’ relationship in java?