Consider the following generic class:
class MyClass<T>{
T field;//ok
public void method (T t){...}//ok
public <E> MyClass(E[] e){
E ee= new E();// compile error
T t= new T();// compile error
}
}
Why we cant instanciate of T
and E
? We know all about of types T,E
at run time. I think that the type parameters T,E
can be considered as a some reference type.