Boxing (computer programming): Difference between revisions

Content deleted Content added
Unboxing: grammar; questions end with question marks.
Line 4:
 
==Boxing==
In computer science, the term '''boxing''' is used to describe placingplace a primitive type within an object so that the primitive can be used as an object, in a language there is a distinction between a primitive type and an object type. For example, [[list|lists]] may have certain [[methods]] which [[arrays]] might not, but the list might also require that all of its members be objects. In this case, the added functionality of the list might be unavailable to a simple list of numbers.
 
For a more concrete example, in Java, a LinkedList can change its size, but an array must have a fixed size. You might desire to have a LinkedList of ints, but the LinkedList class only lists objects -- it cannot list primitive types.