处理包装类的功能
尽管包装器类提供了所需的功能,但由于所操作的数据的原始版本和包装器版本之间需要进行必要的转换,Java 代码有时过于复杂。这该如何处理呢?
Although the Wrapper classes provide needed functionality, Java code is sometimes overly complicated due to the necessary conversions between the primitive and wrapper versions of data being manipulated. How can this be handled?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Java 中,现在通过一个名为 自动装箱。
当代码需要引用类型但您传递了原始类型时,就会发生自动装箱。一个常见的示例是将项目添加到集合中。
In Java, this is now handled automatically for you through a process known as Autoboxing.
Autoboxing occurs when the code requires a reference type but you have passed a primitive type. A common example is adding items to a collection.
我知道我把它放在评论部分,但这是在再次阅读你的问题之后。这就是他们创建自动装箱的确切原因 --> 自动装箱
I know I put it in the comments section, but this after reading your question again. This is the exact reason they created autoboxing --> Autoboxing