Java generics why this won't work

Posted by gotch4 on Stack Overflow See other posts from Stack Overflow or by gotch4
Published on 2010-01-22T09:59:04Z Indexed on 2010/05/15 14:14 UTC
Read the original article Hit count: 276

Filed under:
|
|

I was writing something using generics and to my surprise I found that this doesn't work:

class foo<T>{

 T innerT = new T();

}

So can't I instantiate the genericized type? Aren't there any ways to do this?

© Stack Overflow or respective owner

Related posts about java

Related posts about generics