package com.xt.thinks15_7;

 import java.util.Arrays;

 class EraseObject1<A> {

 }

 class EraseObject2<A, B> {

 }

 class EraseObject3<K, V> {

 }

 /**
* 擦除测试
*
* @author Administrator
*
*/
public class ErasedTest {
public static void main(String[] args) {
EraseObject1<Integer> eo1 = new EraseObject1<Integer>();
EraseObject2<Object, String> eo2 = new EraseObject2<Object, String>();
EraseObject3<String, Integer> eo3 = new EraseObject3<String, Integer>();
System.out.println(Arrays.toString(eo1.getClass().getTypeParameters()));
System.out.println(Arrays.toString(eo2.getClass().getTypeParameters()));
System.out.println(Arrays.toString(eo3.getClass().getTypeParameters()));
}
}

运行结果:

[A]
[A, B]
[K, V]

从运行结果可以看出这里new的新对象中的泛型类型在打印的时候是无法知晓被擦除了的