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
Explain garbage collection in java?
What are basic data types?
What is identifier give example?
What is the Difference between Final Class && Abstract Class?
What are thread local variables?
What is generic type?
What is a vararg?
Can a class extends itself in java?
which pattern is default in scanner package?
What are the different conditional statements?
What the difference is between execute, execute Query, execute Update?
What is the use of conditional statement?
Explain when classnotfoundexception will be raised ?
Does sprintf allocate memory?
What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?