class Example<E> {
    public static void main(String[] args) {
        try {
            Example<String> e = new Example<String>();
            
            // type is actually Object.class!
            Class<String> type = e.getGenericType();
            System.out.println("type is " + type.getName());
            
            // throws ClassCastException
            String s = type.newInstance();
            
        } catch(Throwable e) {
            e.printStackTrace(System.out);
        }
    }
    
    Class<E> getGenericType() {
        return Example.<E>getClazz();
    }
    
    static <T> Class<T> getClazz(T... param) {
        return (Class<T>) param.getClass().getComponentType();
    }
}