If set accepts only one argument then how can it compare
two objects to avoid duplicates
Answer Posted / ashutosh
for comparison between two objects of the same class, class
must override equals() and hashcode() methods of the object
class.
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
How to declare an arraylist in java?
How do you read and print a string in java?
Can we declare a constructor as final?
What is the purpose of the system class in java programming?
Why we go for collections in java?
What is entry in java?
Difference between stack and queue?
How can we make a class singleton?
How does java pattern compile work?
What does s mean in regex?
What is collection class in java? List down its methods and interfaces.
Explain different ways of creating a thread?
Which java version is latest?
What are the three best choices for a development environment?
What is the method to expand and collapse nodes in a jtree?