Wrapper classes


Primitive data type Wrapper class Used for Boxing
primitive -> wrapper obj.
Unboxing
wrapper obj. -> primitive
Explained in video*
short Short integer number Short.valueOf((short) 7) shortObj.shortValue() Lesson 242
int Integer integer number Integer.valueOf(7) integerObj.intValue() Lesson 224
long Long integer number Long.valueOf(7L) longObj.longValue() Lesson 242
float Float floating point number Float.valueOf(1.23f) floatObj.floatValue() Lesson 242
double Double floating point number Double.valueOf(47.11) doubleObj.doubleValue() Lesson 224
boolean Boolean truth value Boolean.valueOf() booleanObj.booleanValue() Lesson 224
char Character unicode character Character.valueOf('J') characterObj.charValue() Lesson 241
byte Byte sequence of 8 bits
(a bit is 0 or 1)
Byte.valueOf((byte) 42) byteObj.byteValue() Lesson 242
* Please buy the course Java for newcomers and log in to udemy.com to watch the explanation videos.