是自动装箱和拆箱操作员重载

Swa*_*rma 1 java

自动装箱和拆箱实际上是运营商重载的奇特术语吗?我们说什么会发生什么Integer i = 10;

Jon*_*ust 6

不,这不是运营商超载.Java没有为运算符重载提供任何机制.

Integer i = 10;
Run Code Online (Sandbox Code Playgroud)

就像说:

Integer i = Integer.valueOf(10);
Run Code Online (Sandbox Code Playgroud)

这根本不会超载=.

  • @shrodes`static Integer valueOf(int i)`:["返回表示指定int值的Integer实例."](http://download.oracle.com/javase/6/docs/api/java/lang/Integer的.html) (2认同)