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 can I right-justify a string?
Is singleton a bad practice?
What is default locale java?
Can we override constructors in java?
What is t in generics in java?
how to know the total memory occupied by the objects in the ArrayList(Array list may contain duplicate objects)
When is the garbage collection used in Java?
Is treeset sorted in java?
What is a prefix function.write down a code to compute prefix function.
What is functional interface in javatpoint?
How we create object in copy constructor?
Why destructor is not used in java?
What is the relationship between clipping and repainting under awt?
Can long be null in java?
What is off heap memory?