Wildcards

Q.

What is the output of this program?

    import java.util.*;
    class Output {
        public static double sumOfList(List list) {
            double s = 0.0;
            for (Number n : list)
                s += n.doubleValue();
            return s;
        }
        public static void main(String args[]) {
            List li = Arrays.asList(1, 2, 3);
            System.out.println(sumOfList(li));
        }
    }
A. 0
B. 4
C. 5.0
D. 6.0

Answer : Option D

Explanation :

None.
Output:
$ javac Output.javac
$ java Output
6.0