Home » JAVA Programming » Generics » Question
  1. What is the output of this program?
    import java.util.*;
    public class Result
    {
    public static double sumOfList(List list)
    {
    double var = 0.0;
    for (Number num : list)
    var += num.doubleValue();
    return var;
    }
    public static void main(String args[])
    {
    List ListObject = Arrays.asList(10, 20, 30);
    System.out.println(sumOfList(ListObject));
    }
    }
    1. 10
    2. 20.0
    3. 30.0
    4. 50.0
    5. 60.0
Correct Option: E

None of these



Your comments will be displayed only after manual approval.