Based on what I read here StackOverFlow array from a class..., I expected the following code to compile. I get an error, "<identifier> expected". I get the same result with Array.newInstance. What am I doing wrong?
import java.lang.reflect.Array;
public class Outer<E> {
private Inner[] array;
public Outer() {
@SuppressWarnings("unchecked")
array = (Inner[])new Outer<?>.Inner[10];
//array = (Inner[])Array.newInstance(Inner.class, 10);
}
public class Inner {
E data;
}
}