当前位置: 代码迷 >> J2SE >> Eclipse 无法使用 转换字符解决思路
  详细解决方案

Eclipse 无法使用 转换字符解决思路

热度:42   发布时间:2016-04-24 13:51:37.0
Eclipse 无法使用 转换字符
public   class   SimpleArray2   {
        public   static   void   main(String[]   args)   {
                int   score[]   =   new   int[]   {90,   85,   55,   94,   77};
 
                for(int   i   =   0;   i   <   score.length;   i++)  
                        System.out.printf( "score[%d]   =   %d\n ",   i,   score[i]);  
        }
}

例如System.out.printf( "score[%d]   =   %d\n ",   i,   score[i]);   里面的printf会报错说“方法不使用”
请问怎么解决?我的是jdk1.6的

------解决方案--------------------
可能是你项目的JDK没有指定为JDK1.6,又或者项目属性中“Java Compiler”中指定的Compiler compliance level没有指定为6.0
------解决方案--------------------
jdk1.5几颗
------解决方案--------------------
同意楼上的,在 Window --> Preferences... --> Java --> Compiler 的 Compiler compliance level 改为 6.0 的就可以了。
------解决方案--------------------
6 也可以啊,只不过可能在 Eclipse 设置的编译级别变成了 1.4 的缘故吧。
  相关解决方案