Consider the following code :
class R2<E>
{
E a;
E get()
{
return a;
}
void set(E a)
{
this.a=a;
}
public static void main(String aa[])
{
R2 nn1=new R2<Integer>();
nn1.set("hello"); (1)
//String r=nn1.get();
//Integer t=nn1.get();
}
}
In line (1), an unchecked warning is given as the compiler is not sure as to the generic type of nn1 (its raw type). But what I can't understand is that when the program is run, why is no exception thrown at line (1).
What is E once the program has been compiled ?