I'm trying to create an array of ListNode<String>
in Java.
I get this error: "cannot create a generic array of ListNode<String> []
when I try to create the array as such:
ListNode<String> [] array = new ListNode<String> [4];
But when I create it like this:
ListNode<String> [] array;
I get an error further down when I try to set spots in the array. For example:
array[0]=start;
array[1]=start2;
Gives me the error "The local variable array may not have been initialized."
How do I fix this? Sorry if this is a basic question! I am in high school.