Introduction to OOP Chapter 19: Container Classes : next previous audio real text

Storing Primitive Values

In some languages (Java, Delphi) primitive types are not objects.

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
Intro OOP, Chapter 19, Slide 08