首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

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

2012-01-06 
Eclipse 无法使用 转换字符publicclassSimpleArray2{publicstaticvoidmain(String[]args){intscore[]newi

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 的缘故吧。

热点排行