public class ObjectBeanA {
public void show(String str){
System.out.println(str);
}
public void show(int i){
System.out.println(i);
}
}
public class TestObjectA {
public static void main(String[] args) {
ObjectBeanA ob = new ObjectBeanA();
ob.show("hello jsu");
ob.show("2021404214");
}
}//未应用泛型
hello jsu
2021404214//结果所示
public class ObjectBeanA<T> {
public void show(T t) {
System.out.println(t);
}
}
public class TestObjectA {
public static void main(String[] args) {
ObjectBeanA ob = new ObjectBeanA();
ob.show("hello jsu");
ob.show("2021404214");
ob.show("ture");
}
}