Generics in Methods and Constructors2777 - Java Quiz Question


What will be the output of the following program?

public class GenericConstructorsDemo {
    public static void main(String args[])
    {
        Gen obj = new Gen(100);
        obj.print();
    }
}
class Gen
{
    private double value;
    <T extends Number> Gen(T value)
    {
        this.value = value;
    }
    void print()
    {
        System.out.println(value);
    }
}


A
100.0
B
Some other output
C
Compilation Error
D
Runtime Error