Possible Duplicate:
Java how to: Generic Array creation
I wanna create something like this:
public class MyClass<T> {
private int row;
private int column;
private T[][] result;
public T[][] generation(int size, T[] values) {
result = new T[values.length][size];
generator(0, 0);
return result;
}
}
But I’m gettin an error “generic array creation”, how can I fix that? 🙁
If you can get the type of
Ti.e.Class<T>, you can utilizeArray.newInstanceas follows…