Specifications

Sun Services
Java™ Programming Language
Module 6, slide 43 of 43
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Autoboxing of Primitive Types
Autoboxing has the following description:
Conversion of primitive types to the object equivalent
Wrapper classes not always needed
Example:
int pInt = 420;
Integer wInt = pInt; // this is called autoboxing
int p2 = wInt; // this is called autounboxing
Language feature used most often when dealing with
collections
Wrapped primitives also usable in arithmetic
expressions
Performance loss when using autoboxing