-
- class Demo<T>
- {
- public void method(T t)
- {
- System.out.println("method :"+ t);
- }
-
- public static <W> void staticMethod(W w)
- {
- System.out.println("staticMethod :"+ w);
- }
-
- public <K> void show( K k)
- {
- System.out.println("Show :"+ k);
- }
-
- public <Q> void print(Q q)
- {
- System.out.println("Print :"+ q);
- }
- }
-
- class TestDemo
- {
- public static void main(String [] arags)
- {
- Demo<Double> d = new Demo<Double>();
-
- d.method(3.4);
-
- d.staticMethod(true);
-
- d.show("haha");
-
- d.print(new Integer(4));
- }
- }
JAVA 泛型方法 和 静态方法泛型
原文:http://www.cnblogs.com/bigben0123/p/4142969.html