AP® Computer Science A glossary

Autoboxing

Course: AP® Computer Science A Shows up in: Unit 4: Data Collections

The automatic conversion the compiler makes from a primitive value to its wrapper class object, such as int to Integer or double to Double.

Appears in the course and exam description (CED): 4.7.A.2

It happens when a primitive value is assigned to a variable of the wrapper class, or passed to a parameter of that wrapper class, such as list.add(5) on an ArrayList<Integer>.

Integer goals = 3;
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(goals + 1);
System.out.println(list);

Output:

[4]
Learn it properly, with a checkpoint 4.7 Wrapper Classes

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure