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


Please Help Members By Posting Answers For Below Questions

What are the three best choices for a development environment?

617


What does compareto () do in java?

578


What is the right data type to represent a price in java?

574


What is java object name?

553


What is bytecode verifier?

508






What is map java?

521


Why arraylist is not synchronized in java example?

475


Explain constructors and types of constructors in java.

646


Which api is provided by java for operations on set of objects?

919


Why is inheritance used in java?

613


Is there is any difference between a scrollbar and a scrollpane?

566


How to retrieve data from database in java using arraylist?

532


What is a two-pass assembler?

611


What ide should I use for java?

497


What is the main method java?

539