A

Admin • 832.52K Points
Coach

Q. What will be the output of the following code

Code:
import java.util.ArrayList;
import java.util.List;
public class ListDemo {

public static void main (String args[])
{
List<Integer> list=new ArrayList<Integer>();
list.add(2);
list.add(3);
m(list);
public static void m(List<Number> list) {
System.out.println(list);
}
}

}
  • (A) 3
  • (B) 3.0
  • (C) Compile time exception
  • (D) Runtime exception
  • Correct Answer - Option(D)
  • Views: 22
  • 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.