class Sample<T> {
T[] arr = new T[5];
As I know, new-operator must know the type of T in compile time, so the above code makes an error.
class Sample<T> {
ArrayList<T> list = new ArrayList<T>();
I think new-operator in this code also doesn't know the type of T in compile time.
So, at the same context, I think this code should make an error, but it doesn't.
I don't know why. Please help.