public class UserDefined {
public static void main(String[] args) {
Teacher<Integer> p = new Teacher<Integer>(11, 11, "bb");
System.out.println(p.getT());
System.out.println(p.getA());
System.out.println(p.getAa());
}
}
class Teacher<T> {
private T t;
private int age;
private String name;
public T getT() {
return t;
}
public void setT(T t) {
this.t = t;
}
public int getA() {
return age;
}
public void setA(int age) {
this.age = age;
}
public String getAa() {
return name;
}
public void setAa(String name) {
this.name = name;
}
public Teacher(T t, int age, String name) {
super();
this.t = t;
this.age = age;
this.name = name;
}
@Override
public String toString() {
return "Person [a=" + age + ", aa=" + name + ", t=" + t + "]";
}
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。