T

Tina Singh • 10.85K Points
Tutor II

Q. What will be the output of given code

Code:
import java.util.HashSet;
import java.util.Set;
public class HashSetTest
{
public static void main (String args[])
{
Set hashSet = new HashSet();
hashSet.add(“1”);
hashSet.add(1);
hashSet.add(null);
hashSet.add(“null”);
System.out.println(hashSet);
}

}
  • (A) [null, 1]
  • (B) [1]
  • (C) [null, 1, 1, null]
  • (D) Runtime exception

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.