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);
}
}
}
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
B. Test - 10
C. Runtime Exception
D. Compilation Failure
Answer: Option A
Join The Discussion