I have a code, whose MCVE is like this
import java.util.LinkedList;
public class Test
{
LinkedList<Node>[] arr;
Test(){
arr = new LinkedList<Node>[4];
}
public static void main(){
}
}
class Node{
}
where I get this error
error: generic array creation
arr = new LinkedList<Node>[4];
^
I looked for the error and found these two posts How to create a generic array in Java? and Error: Generic Array Creation
But I don't understand what a generic array is. I guess(from what I get from the two posts) it means array that does not know what type it's going to store, but in my case the array is specified to be of LinkedList<Node>
type.
Can someone explain the concept?