Mind map
Wrapper Classes
Map content
Wrapper Classes
**ALL PRIMITIVES HAVE A WRAPPER CLASS**
Wrapper classes do not have no-args constructors.
Constructing a wrapper class:
- Ex: Interger i1 = new Integer("5")
- Also: Integer i1 = new Integer(5)
- Ex: Interger i1 = new Integer("5")
Ops/Methods:
- datatypeValue() ex: intValue: turns whatever its called on into an int
- valueOf(String s): creates a new object initialized to the value represented in the string.
- compareTo(value): compares two Wrapper classes together returns 1 if >, -1 if <. & 0 if =
- parseInt(String s) or parseDouble(String s): returns the int or double value of the inputted String. Call it like this: Integer.parseInt("12")
- compareTo(value): compares two Wrapper classes together returns 1 if >, -1 if <. & 0 if =
- valueOf(String s): creates a new object initialized to the value represented in the string.
- datatypeValue() ex: intValue: turns whatever its called on into an int
Autoboxing: going from a primitive data type to a Wrapper Object.
- Ex: Integer int1; int val = 12; int1 = val;
Unboxing: going from a primitive data type to a Wrapper object.
- Integer int2 = new Integer(14); int val2; val2 = int2
Information
- Description
- Computer Science Mind Map on Wrapper Classes, created by Tate Johnson on 27/04/2021.
- Created by
- Tate Johnson
- Views
- 2
- Rating