문제

While compiling the code I get an unexpected error, which never occurred before, it says that I cannot convert from int to an Object...

Code:

maxBundles = max;
    bundleProgressBar.setMaximum(max);
    bundleProgressLabel.setText("Updating Components...");
    // Tell JS that the state is Installing.
    Object[] arr = { 1 };

error:

`103: error: incompatible types
[javac]         Object[] arr = { 1 };`

I know this is a problem with eclipse, because it worked before, so my question is what can I change to resolve it...

도움이 되었습니까?

해결책

What you're trying to do is called autoboxing - the process of converting a primitive (int in this case) to its Object represantation (Integer in this case), automatically. More on autoboxing and unboxing here.

Autoboxing was introduced in Java 1.5. So check that your project's compiler compliance level is set to 1.5 or above (Project properties -> Java compiler).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top