方法 | 描述 |
---|---|
double min(double arg1, double arg2) float min(float arg1, float arg2) int min(int arg1, int arg2) long min(long arg1, long arg2) | 回傳參數中的較小值 |
舉例如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | class MinDemo { public static void main(String[] args) { System.out.println(Math.min( 35 , 48 )); System.out.println(Math.min( 22.3 , 22.1 )); System.out.println(Math.min( 0 .00365f, 0 .00365002f)); System.out.println(Math.min(652l, 965l)); } } /* 《程式語言教學誌》的範例程式 檔名:MinDemo.java 功能:示範物件導向的基本觀念 作者:張凱慶 時間:西元 2010 年 10 月 */ |
編譯後執行,結果如下

中英文術語對照 | |
---|---|
方法 | method |
參數 | parameter |
沒有留言:
張貼留言