public class GenDemo<K,V,T> { //这里K,V,T代表类型 private T t; private Hashtable<K,V> h = new Hashtable<K,V>(); public void put(K k, V v){ h.put(k, v); } public V get(K k){ return h.get(k); } public T get(){ return t;
}
public static void main(String[] args) { GenDemo<String,String,String> t =new GenDemo<String,String,String>(); t.put("key", "value"); System.out.println(t.get("key"));
[code="java"]import java.util.Hashtable;public class GenDemo {//这里K,V,T代表类型 private T t; private Hashtable h = new Hashtable(); public void put(K k, V v){ h.put(k, v); } public V ge...