泛型的实质 取代OBJECT 不用强制类型转换 使得程序更安全
http://blog.csdn.net/explorers/archive/2005/08/15/454837.aspx
public interface Iterator<E> {
E next();
<T> void tt(T t);
<F> F ff(F t);
}
public class IteratorImpl implements Iterator<String>{
public <F> F ff(F t) {
return t;
}
public String next() {
return "next";
}
public <T> void tt(T t) {
System.out.println(t.toString());
}
public static void main(String[] args){
IteratorImpl it = new IteratorImpl();
String aa = it.ff("aa");
Integer bb = it.ff(1);
it.tt("bb");
it.tt(1);
}
}