/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.reflect.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
  public abstract static class ArrayListGeneric1<T> {
    private int capacity = 1;
    private int size = 0;
    T[] array = (T[]) Array.newInstance(getElementType(), capacity);

    public ArrayListGeneric1() {}   

    Class<?> getElementType() {
      ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass();
      Type[] typeArgs = pt.getActualTypeArguments();

      // Will fail if it's not a class type.
      return (Class<?>) typeArgs[0];
    }
}

	public static void main (String[] args) throws java.lang.Exception
	{
		System.out.println(new ArrayListGeneric1<String[]>() {}.array.getClass());
        System.out.println(new ArrayListGeneric1<Integer>() {}.array.getClass());
	}

}