Boxing Unboxing in java [duplicate]
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.
精彩评论