本人对泛型的使用不是很多,了解也不是很深,在此记录一些自己的认识。

 1 public class FanXing2 {
 2 
 3     /**
 4      * @param args
 5      */
 6     public static void main(String[] args) {
 7         // TODO Auto-generated method stub
 8         Fx<String> fx = new Fx<String>("简单的泛型列子");
 9         fx.showType();
10     }
11 }
12 
13 class Fx<T> {
14     private T t; // 定义泛型成员变量
15 
16     public Fx(T t) {
17         this.t = t;
18     }
19 
20     public void showType() {
21         System.out.println(t.getClass().getName()+":"+t);
22     }
23 }

上面是一个简单的泛型类的列子

http://www.cnblogs.com/panjun-Donet/archive/2008/09/27/1300609.html

相关文章:

  • 2022-02-20
  • 2021-05-26
  • 2022-12-23
  • 2021-12-17
  • 2021-12-31
  • 2022-02-10
猜你喜欢
  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
相关资源
相似解决方案