0
每當我運行這個測試程序它顯示,0.0 instead of 0.5
爲什麼Eclipse不顯示小於零的數字?
有誰知道如何解決這個在Eclipse中?
public class Test {
public static void main(String[]args){
double distance;
distance = 1/2;
System.out.println(distance);
}
}
您正在使用INT文字。只需將這些操作數中的一個作爲雙重類型。 – Andrew