Vidyalelo
Java Programming · Q128

Java Collections Framework

Programming · Java Programming · question 128

Q128

What will be the output of the following Java program? import java.util.*; class Output public static void main(String args[]) HashSet obj = new HashSet(); obj.add("A"); obj.add("B"); obj.add("C"); System.out.println(obj + " " + obj.size());

A.
ABC 3
B.
[A, B, C] 3
Answer
C.
ABC 2
D.
[A, B, C] 2

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board