泛型方法实例
/** * * @author chase * 2011-04-26 * 泛型方法实例 * */public class ExampleA {public <T> void f(T x) {System.out.println(x.getClass().getName());}public static void main(String args[]) {ExampleA ea = new ExampleA();ea.f("");ea.f(23);ea.f("chase");ea.f(3.1415926);ea.f('a');ea.f(ea);}}
?