Boxing Unboxing in java

Possible duplicates:
When to use a wrapper class and a primitive type
What is boxing and unpacking and what are the trade-offs?

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

+3
source share
1 answer

Autoboxing / unboxing is a pure convenient function that allows you to assign primitive values ​​to a shell class reference and vice versa, while the compiler automatically adds code to convert between them.

+4
source

Source: https://habr.com/ru/post/1770879/


All Articles