public class MainClass
{/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
System.out.printf("%d\n",45+56);}}
在命令行和netbean5中编译通过,但在Eclipse3.1中得到下列Error Message
The method printf(String, Object[]) in the type PrintStream is not applicable for the argument (String, int)请有识之士不吝赐教。这里先谢过了。

解决方案 »

  1.   

    JDK1.4没有这个方法,和你用的JDK有关系吧
      

  2.   

    这是C的写法。
    java没这种写法的。
    用System.out.println(45+56),换行输出
    不换行的是System.out.print(45+56)
      

  3.   

    Java 编译器选JDK5.0, 5.0以下没有printf
      

  4.   

    printf这个方法还是是jdk1.5才有的吧?
      

  5.   

    晕~
    把C语言的printf()函数玩出来了
      

  6.   

    各位,我用的是JDK1.5 update6,最新版本。我的目的就是要测试System.out.printf()方法。代码在命令行和Netbean5中编译通过,但在Eclipse中出现问题。