java泛型小例子01

 1 class info<T> {
 2     private T name;
 3 
 4     info(T name){
 5         this.name = name;
 6     }   
 7 }
 8  
 9 class hello{
10 
11     public static void function(info<?> temp){
12         System.out.println("内容: "+temp);
13     }    
14 
15     public static void main(String[] args){
16         info<String> demo=new info<String>("Rollen");
17         function(demo);
18     }
19 
20 }

 

posted @ 2015-05-08 06:46  okay4321  阅读(116)  评论(0编辑  收藏  举报