class Info<T,V>{
private T var;
private V value;
public Info(T var, V value) {
super();
this.var = var;
this.value = value;
}
public T getVar() {
return var;
}
public void setVar(T var) {
this.var = var;
}
public V getValue() {
return value;
}
public void setValue(V value) {
this.value = value;
}
}
class Demo<S>{
private S info;
public Demo(S info){
this.setInfo(info);
}
public S getInfo() {
return info;
}
public void setInfo(S info) {
this.info = info;
}
}
public class Test {
public static void main(String[] args) {
Demo<Info<String,Integer>> d = null;
Info<String,Integer> i = null;
i = new Info<String,Integer>("张三",30);
d = new Demo<Info<String,Integer>>(i);
System.out.println(d.getInfo().getVar());
System.out.println(d.getInfo().getValue());
}
private T var;
private V value;
public Info(T var, V value) {
super();
this.var = var;
this.value = value;
}
public T getVar() {
return var;
}
public void setVar(T var) {
this.var = var;
}
public V getValue() {
return value;
}
public void setValue(V value) {
this.value = value;
}
}
class Demo<S>{
private S info;
public Demo(S info){
this.setInfo(info);
}
public S getInfo() {
return info;
}
public void setInfo(S info) {
this.info = info;
}
}
public class Test {
public static void main(String[] args) {
Demo<Info<String,Integer>> d = null;
Info<String,Integer> i = null;
i = new Info<String,Integer>("张三",30);
d = new Demo<Info<String,Integer>>(i);
System.out.println(d.getInfo().getVar());
System.out.println(d.getInfo().getValue());
}
}
运行结果:
张三
30