在myeclipse6.0编译完全通过的代码,在myeclipse10却编译报错。使用的jdk都是自己安装的jdk6.0(不是eclipse自带的),编译级别都是6.0.
代码如下:
Long a = new Long(0);
a+=new Float("3.2");
在myeclipse10中提示的错误如下:
The operator += is undefined for the argument type(s) Long, float
+= This operator is defined for basic types. The a and newFloat("3.2") you have here are both objects, so they cannot be calculated. Moreover, the classes under these two Number packages do not provide operation methods. If you want to do +3.2 operation on a, you need to:
Long a = new Long(0);
Float f = new Float("3.2");
long result = a.longValue() + f.longValue();
+= This operator is defined for basic types. The a and newFloat("3.2") you have here are both objects, so they cannot be calculated. Moreover, the classes under these two Number packages do not provide operation methods. If you want to do +3.2 operation on a, you need to: