Possible Duplicate:
Create instance of generic type in Java?
I've a little trouble. I cannot instantinate generic type instance in default constructor. here is my class
public class MyClass<U extends MyUser> {
private U user;
public U getUser() {
return this.user;
}
public void setUser(U user) {
this.user = user;
}
public MyClass() {
this.user = new U();
}
}
in code line this.user = new U()
I'm getting exception
cannot instantinate type U
. How can I create new instance of U?
Thanks in advance