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
What is the difference between compile-time polymorphism and runtime polymorphism?
Can an interface be defined inside a class?
What does || mean in code?
Does printwriter create a file?
What does file separator do in java?
What is a classloader in java?
What is difference in between java class and bean?
How does the java compiler work?
What is the purpose of main function in java?
What is the difference between sleep and wait in java?
What are 4 pillers of object orinted programming?
What are the types of java languages?
Which methods cannot be overridden in java?
What is flag in python?
Why can't you declare a class as protected?