Examveda

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

C. ABC 2

D. [A, B, C] 2

Answer: Option B


This Question Belongs to Java Program >> Collections Framework In Java

Join The Discussion

Related Questions on Collections Framework in java