Skip to main content
Using Wrappers
- The wrapper classes correlate to the primitive types.
- Wrappers have two main functions:
- To wrap primitives so that they can be handled like objects
- To provide utility methods for primitives (usually conversions)
- The three most important method families are
- xxxValue() Takes no arguments, returns a primitive
- parseXxx() Takes a String, returns a primitive, throws NFE
- valueOf() Takes a String, returns a wrapped object, throws NFE
- Wrapper constructors can take a String or a primitive, except for Character, which can only take a char.
- Radix refers to bases (typically) other than 10; octal is radix = 8, hex = 16.