1 import java.lang.reflect.*;
2 import java.util.Collection;
4 public class ReflectionTest {
6 public Collection<String> c;
8 public static void main(String[] args) throws NoSuchFieldException {
9 System.out.println(Collection.class.getTypeParameters()[0]); // E
10 Field field = ReflectionTest.class.getField("c");
11 System.out.println(field.getGenericType()); // java.util.Collection<java.lang.String>