• Post Reply Bookmark Topic Watch Topic
  • New Topic

generic class question  RSS feed

 
jwiscou chen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anybody tell me why generate follow result.
thanks advance
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks like an assignment quetion. JavaRanch is a learning resource so we are strongly discouraged from posting staight answers to assignment questions. What do you think the answer is? Post your answer and people may comment on where you've gone wrong (if indeed you go wrong )
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LinkedList<String>[] list = new LinkedList<String>[12]; //will not compile!!!

You cannot create arrays of concrete generic types. It's stupid, but it's a limitation of the way arrays and generics work in Java.

I explain this problem in more detail in this blog entry.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!