| 方法 | 描述 |
|---|---|
| double rint(double d) | 回傳最接近參數的整數值 |
舉例如下
class RintDemo {
public static void main(String[] args) {
System.out.println(Math.rint(9.0));
System.out.println(Math.rint(9.1));
System.out.println(Math.rint(9.2));
System.out.println(Math.rint(9.3));
System.out.println(Math.rint(9.4));
System.out.println(Math.rint(9.5));
System.out.println(Math.rint(9.6));
System.out.println(Math.rint(9.7));
System.out.println(Math.rint(9.8));
System.out.println(Math.rint(9.9));
}
}
/* 《程式語言教學誌》的範例程式
http://pydoing.blogspot.com/
檔名:RintDemo.java
功能:示範物件導向的基本觀念
作者:張凱慶
時間:西元 2010 年 10 月 */編譯後執行,結果如下

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