Which Java collection does not allow duplicate elements?
A
Vector
B
ArrayList
C
HashSet
Correct answer
D
LinkedList
Correct answer
C. HashSet
22 views
⚔️
Challenge a friend on JAVA
Same MCQs, timed, live leaderboard. Send the link on WhatsApp – no sign-up needed.
Create challenge
Explanation
HashSet implements the Set interface, which rejects duplicates using equals() and hashCode(). Lists such as ArrayList, LinkedList and Vector allow duplicates.
Reference
Asked in: NTS, PPSC, OCA Java
Doubts & discussionNot sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ
‹ Previous MCQ In Java, what does "Hello" == new String("Hello") evaluate to? Next MCQ › Which exceptions must be either caught or declared in a throws clause?