引用:https://blog.csdn.net/chenhao0568/article/details/52233783
Eclipse中 JAVA默認的兼容版本為1.4, 改為1.5及以上版本就行。 項目 》屬性》Java complier》complier compliance lever:1.5
System.out.printf("%f",d);//"f"表示格式化輸出浮點數。
就正常了。
1.4版本 中 printf參數類型不一樣,所以報錯。
The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int)