3. Java面向对象之泛型-指定多个泛型

3. Java面向对象之泛型-指定多个泛型


package generic;


class MutiGeneric<K, T> {
private K key;
private T take;


public K getKey() {
return key;
}


public void setKey(K key) {
this.key = key;
}


public T getTake() {
return take;
}


public void setTake(T take) {
this.take = take;
}


}


public class genricDemo02 {


public static void main(String[] args) {
MutiGeneric<Integer, String> g = new MutiGeneric<Integer, String>();
g.setKey(10);
g.setTake("多個泛型的使用");
System.out.println(g.getKey() + g.getTake());


}


}

版权声明:本文为小平果原创文章,转载请注明:http://blog.csdn.net/i10630226

posted @ 2015-07-28 21:11  dingxiaoyue  阅读(939)  评论(0编辑  收藏  举报