Using Built-In Classes
Learn about some of the most commonly used Java built-in classes.
StartKey Concepts
Review core concepts you need to learn to master this subject
Autoboxing Primitive Types
Unboxing Wrapper Classes
Integer and Double Wrapper Classes
Integer and Double Static Fields
Static Methods
Calling a Static Method
The Math Class
Autoboxing Primitive Types
Autoboxing Primitive Types
// These are all examples of autoboxing
Double wrapper1 = 23.456;
Integer wrapper2 = 3;
Double wrapper3 = new Double(13.57);
Integer wrapper4 = new Integer(7);
Double wrapper5 = Double.valueOf(30.59);
Integer wrapper6 = Integer.valueOf(15);
Autoboxing is the automatic conversion that the Java compiler makes between primitive types and their corresponding object wrapper classes. This includes converting an int
to an Integer
and a double
to a Double
.