我编程时编入一句:System.out.printf("%10.2f",b);
后来编译的时候系统提示说:The method printf(String,Object[])in the type PrintStream is not applicable for the arguments(String,double).
不知道应该怎么改动,大家帮忙一下!
后来编译的时候系统提示说:The method printf(String,Object[])in the type PrintStream is not applicable for the arguments(String,double).
不知道应该怎么改动,大家帮忙一下!
public class test {
public test() {
} public static void main(String[] args) {
double b=1.01;
String a="%10.2f";
System.out.printf(a,b);
}
}
project按右键->Properties->compiler
把编译调成5.0而非1.4 or 1.3
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
at Ha.main(Ha.java:20)
你的错误应该是 你所用的量出了错误
The method printf(String,Object[])
是说打印String类型的Objectin
the type PrintStream is not applicable for the arguments(String,double).
我也只能看个大概
好像是说没有找到,double可以这么说 你需要改下你量
double类型或String类型有错误
System.out.printf("%10.2f",new Object[]{new Double(0.1)});