Boxing (computer programming): Difference between revisions

Content deleted Content added
No edit summary
Line 9:
 
==Boxing==
"Boxing", otherwise known as "wrapping", is the process of placing a primitive type within an object so that the primitive can be used as a reference object. For example, [[List (computing)|lists]] may have certain [[Method (computer science)|methods]] which [[array data type|arrays]] might not, but the list might also require that all of its members be dynamic objects. In this case, the added functionality of the list might be unavailable to a simple array of numbers.
For a more concrete example, in Java, a {{Javadoc:SE|java/util|LinkedList}} can change its size, but an array must have a fixed size. One might desire to have a {{Java|LinkedList}} of {{Java|int}}s, but the {{Java|LinkedList}} class only lists references to dynamic objects — it cannot list primitive types, which are value types.