Generics Unbounded Wildcard2879 - Java Quiz Question


What will be the output of the following program?

public class GenericsWildCardDemo1 {
    public static void main(String args[])
    {
        Double[] ob =  {1.2, 2.3, 3.4, 4.5, 5.6};
        StoreNumbers<Double> obj = new StoreNumbers<Double>(ob);
        print(obj);
    }
    static void print(StoreNumbers<?> c)
    {
        for(int i = 0; i < c.obj.length; i++)
        {
            System.out.print(c.obj[i] + " ");
        }
    }
}

class StoreNumbers<T extends Number>
{
    T[] obj;
    StoreNumbers(T[] obj) {
        this.obj = obj;
    }
}


A
1 2 3 4 5
B
1.2 2.3 3.4 4.5 5.6
C
Compilation Error
D
Runtime Error