Performance impact of autoboxing

前端 未结 3 423
闹比i
闹比i 2020-12-09 10:32

Usually the compiler generates code to perform boxing and unboxing. But what does the compiler, if the boxed values are not needed? Is the (Oracle standard) compiler smart e

3条回答
  •  生来不讨喜
    2020-12-09 11:03

    Will the compiler actually insert code for boxing each value of the array?

    The compiler will reject the code because an int[] cannot be passed into a method that takes an Object[] parameter.

    Autoboxing happens only for individual primitive values, never for entire arrays.

提交回复
热议问题