Javaの静的最終ジェネリッククラスオブジェクト

Javaの静的最終ジェネリッククラスオブジェクト

クラスTestClassを<T> { 
パブリックTのT; 

公共ボイド敷石(T tの){ 

this.t = T。

} 

パブリックT GETT(){ 

戻りT。

} 

} 

publicクラスStaticObj { 

パブリック静的最終TestClassを<整数> TC =新しいTestClassを<整数>(); 

パブリック静的無効メイン(文字列[] args){ 

tc.setT(新しい整数(101))。

System.out.println( "tc.t: "+ tc.getT()+" \ nを"); 

tc.setT(新しい整数(102))。

System.out.println( "tc.t: "+ tc.getT()+" \ nを"); 

tc.setT(新しい整数(103)); 

System.out.println( "tc.t: "+ tc.getT()+" \ nを"); 

// TC =新しいTestClassを<整数>();


 

結果:

tc.t:101

tc.t:102

tc.t:103

 

 

 

 

 

 

  

おすすめ

転載: www.cnblogs.com/aspirs/p/11446685.html