A

Admin • 802.91K Points
Coach

Q. What will be the output of the following code

Code:
import java.util.List;
import java.util.ArrayList;

public class MyClass {

public static void main(String…a)
{
List<Integer> l = new ArrayList<Integer>();
l.add(2);
m(1);
}
static void m(List<? super Double> l)
{
System.out.println(l.get(0));
System.out.println(l.get(1));
}
}
  • (A) Runtime Exception – NullPointer
  • (B) Runtime Exception – IndexOutOfBound
  • (C) Compile time error
  • (D) 23
  • Correct Answer - Option(C)
  • Views: 5
  • Filed under category Java
  • Hashtags:

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.

Be the first to start discuss.