packagecode0507;publicclassWildCardTest{publicstaticvoidmain(String[]args){Box<String>name=newBox<String>("hello");Box<Integer>age=newBox<Integer>(12);Box<Double>number=newBox<Double>(210.50);Box<Integer>point=newBox<Integer>();getData(name);getData(age);getData(number);point.printpoint(520,1314);point.printpoint("me","too");}publicstaticvoidgetData(Box<?>data){//类型通配符System.out.println("data:"+data.getData());}}classBox<T>{privateTdata;publicBox(){}//构造方法重载publicBox(Tdata){setData(data);}publicTgetData(){returndata;}publicvoidsetData(Tdata){this.data=data;}//定义泛型方法public<T1,T2>voidprintpoint(T1x,T2y){T1m=x;T2n=y;System.out.println("This point is:"+m+","+n);}}