使用printf以及int的格式说明符时出现JAVA异常。 PrintStream中发生异常,如下所示

时间:2016-03-21 14:03:25

标签: java

public class Application {
    public static void main(String[] args) {
        int i;
        for (i=0;i<5;i++)
        {
            System.out.printf("The value of integer is: %d",i);
        }
      }
}

以下是执行后的输出

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
        The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int)
at Application.main(Application.java:6)

0 个答案:

没有答案