Vidyalelo
Java Programming · Q62

Java Collections Framework

Programming · Java Programming · question 62

Q62

What will be the output of the following Java code snippet? public class Test public static void main(String[] args) Set s = new HashSet(); s.add(new Long(10)); s.add(new Integer(10)); for(Object object : s) System.out.println("test - "+object);

A.
Test - 10
Test - 10
Answer
B.
Test - 10
C.
Runtime Exception
D.
Compilation Failure

Answer: Option A

Solution

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