Type Erasure2789 - Java Quiz Question


What will be the output of the following program?

public class GenericsErasureDemo {
    public static void main(String args[])
    {
        GenericsErasure<String> stringObject = new GenericsErasure<String>("Hello");
        System.out.println(stringObject.getClass().getName());
    }
}
class GenericsErasure<T> {
    T obj;
    GenericsErasure(T obj)
    {
        this.obj = obj;
    }
}


A
GenericsErasure
B
java.lang.String
C
Compilation Error
D
Runtime Error