Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 483 Bytes

File metadata and controls

17 lines (13 loc) · 483 Bytes

Boxing Conversion

If you try to assign to a boxed type like Integer from some code that gives you the unboxed version like int, then Java will automatically do that conversion.1

~void main() {
int x = 5;
Integer y = x;

IO.println(x);
IO.println(y);
~}

Footnotes

  1. This might feel obvious, but this is one of the few places in Java where the type of something "magically" changes. int and Integer, char and Character, etc. are different types.