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


Please Help Members By Posting Answers For Below Questions

What is difference between static and abstract class?

525


Can a vector contain heterogenous objects?

609


What is java life cycle?

543


What is main function purpose?

531


How do you get the length of a string in java?

526






How does split work in java?

537


Which package has light weight components?

572


What is unsigned char?

633


How many wrapper classes are there in java?

543


What is difference between jdk,jre and jvm?

577


Can constructor be static or final?

660


What is parse method?

553


Are arrays dynamic in java?

541


Add a value x to array from index l to r where 0 <= l <= r <= n-1

638


Why there are some null interface in java? What does it mean?

653