閱讀172 返回首頁    go 阿裏雲 go 技術社區[雲棲]


jdk1.5新特性1之靜態導入


調用Math類的靜態方法,每次都要寫Math點方法。

public static void main(String args)
{
 system.out.print(Math.max(3,6));
 system.out.print(Math.min(3.6));
}

 


JDK1.5支持靜態導入

import static java.lang.Math.max;

public static void main(String args)
{
 system.out.print(max(3,6));
}

當然這樣導入就更可以了import static java.lang.Math.*;

 

最後更新:2017-04-03 20:19:46

  上一篇:go Windows 8不得不說的13個特色功能
  下一篇:go Oracle中的LOB數據類型以及ibatis中處理該類型的typeHandler