我有內部的一些雙重價值的數組:的Java打印出雙陣列
private double speed[] = {50, 80, 120, 70.3};
public void printSpeed() {
for(int i = 0; i<=speed.length-1; i++) {
System.out.println(speed[i]);
}
}
output
50.0
80.0
12.0
70.3
wanted output
50
80
12
70.3
怎麼辦打印陣列的確切字符串?
的System.out.println(速度[1])的toString()代替( 「」」 0" )。? – raven
http://www.dreamincode.net/forums/topic/67144-removing-the-zero-after-the-decimal-point/page__view__findpost__p__434542?s=747a3ccc50326ef03a71c91684c84055 – sathis