且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java:为什么不在这里发生自动装箱?

更新时间:2023-09-18 10:01:04

虽然int自动绑定到Integer,int []不自动绑定到Integer []。

Although int is autoboxed to Integer, int[] is not Autoboxed to Integer[].

数组不是装箱的,只是类型本身。

The arrays are not boxed, just the types themselves.

请参阅:如何将int []转换为列表与LT;整数>在Java中?为解决方法和潜在的原因。

See this: How to convert int[] into List<Integer> in Java? for workarounds and the underlying reasons.