开发者

Boxing Unboxing in java [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Du开发者_JAVA技巧plicates:

When to use wrapper class and primitive type

What is boxing and unboxing and what are the trade offs?

Boxing basically converts primitive type to its corresponding reference type. But when do we need Boxing? Whether Wrapper class and Boxing do the same job?


Autoboxing/unboxing is a pure convenience feature that allows you to assign values of a primitive type a reference of a wrapper class and vice versa, with the compiler automatically adding the code to convert between the two.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜