Wrapper class
A wrapper class is a class created according to the design pattern of an adapter , which mostly wraps the primitive types used in certain object-oriented languages. In this way, all object-oriented properties such as overloading, derivation, etc. are also made possible for these types.
Examples of wrapper classes are the so-called primitive wrapper classes, where the variable created according to this type then inherits all properties from the parent classes. As an example, here are the basic wrapper classes for Java :
Primitive data type | Wrapper class | Constructor arguments |
---|---|---|
boolean |
Boolean |
boolean or String
|
byte |
byte |
byte or String
|
char |
Character |
char
|
double |
Double |
double or String
|
float |
Float |
float , double orString
|
int |
Integer |
int or String
|
long |
Long |
long or String
|
short |
Short |
short or String
|
The Byte
, Short
, Integer
, Long
, Float
, and Double
-Wrapperklassen all of the Number class derived . The void
wrapper class Void exists for the non-type .