System.out.printf("The Sum is %d%n" , sum);
和誤差是 的方法的printf在類型爲PrintStream(字符串,對象[])是不適用的參數(字符串,整數)如何打印變量的值中的java
System.out.printf("The sum is " + sum);
運作,但如果我需要打印
"The Sum of 5 and 6 is 11"
System.out.printf("The sum of %d and %d is %d . " ,a,b,sum);
,但得到的Eclipse平臺版本上述錯誤:3.8.1(Ubuntu的)
在'System.out.printf的錯誤( 「一加一%d%N」,總和);'是%n,你當然是\ n。 – Turo
異常在線程「主要」 java.lang.Error的:未解決問題彙編: \t的方法的printf在類型爲PrintStream(字符串,對象[])是不適用的參數(字符串,整數) \t在加法。 main(addition.java:25) 是錯誤。 –
@Turo'%n'是有效的。 – Tom