Autoboxing isnt working properly [duplicate]

Deadly 提交于 2019-12-11 05:11:26

问题


I am trying to implement autoboxing but it's showing an error:

Cannot convert from int to integer.

package JavaTraining;
public class Wrap { 
    public static void main(String ar[])
    {
        Integer a=100;
        String i=a.toString();
        System.out.println(i);
        System.out.println(a);
    }
}

Eclispe version is 3.1


回答1:


(This is relevant to Eclipse specifically) -
You need to change your Compiler compliance level to at least 1.5.

Project -> Properties -> Java Compiler -> Compiler compliance level



来源:https://stackoverflow.com/questions/38464664/autoboxing-isnt-working-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!