ExamVeda
Login
Home
This question belongs to Java Program Generics In Java
Generics in Java
?

What will be the output of the following Java program?
import java.util.*;
class Output
{
    public static void addNumbers(List<? super Integer> list)
    {
        for (int i = 1; i <= 10; i++)
        {
            list.add(i);
        }
    }
    public static void main(String args[])
    {
       List<Double> ld = Arrays.asList();
       addnumbers(10.4);
       System.out.println("getList(2)");
    }
}

Answer & Solution
Correct Answer: Option A
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.