泛型
我已经连照葫芦画瓢都不会了。。
以下是代码:
package com.huang;
public class Test4 {
static class ThreeBound<A,B,C>{
public final A a;
public final B b;
public final C c;
public ThreeBound(A a,B b,C c){
this.a=a;
this.b=b;
this.c=c;
}
public A getA() {
return a;
}
public B getB() {
return b;
}
public C getC() {
return c;
}
public void printAll(){
System.out.println(a.toString()+" "+b.toString()+" "+c.toString());
}
}
public static void main(String[] args) {
ThreeBound<String,String,String> threebound=new ThreeBound<String,String,String> ("o","h","h");
threebound.printAll();
}
}
一下为运行结果: