Forums Register Login
generic class question
can anybody tell me why generate follow result.
thanks advance
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 )
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.
Everybody! Do the Funky Monkey! Like this tiny ad!
Programmatically Create PDF Using Free Spire.PDF with Java

This thread has been viewed 573 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jan 17, 2019 09:45:48.