Introduction to OOP | Chapter 19: Container Classes : | next | previous | audio | real | text |
These values cannot be stored using this scheme.
Thus, languages introduce wrapper classes that do nothing but hold a primitive value.
Vector aVector = new Vector(); aVector.add(new Integer(17)); // wrap up primitive int as Integer ... Integer a = aVector.elementAt(1); int x = a.intValue(); // must subsequently be unwrapped