泛型
class Test<T1,T2>{
private T1 name;
private T2 age;
public void setName(T1 name){
this.name = name;
}
public void setAge(T2 age){
this.age = age;
}
public T1 getName(){
return this.name;
}
public T2 getAge(){
return this.age;
}
public void printOut(){
System.out.println("Name:"+this.name + " Age:"+this.age);
}
}
public class fanxing{
public static void main(String[] args){
Test<String ,Integer> T = new Test<String ,Integer>();
T.setName("aaaaaaa");
T.setAge(555);
T.printOut();
}
}