Mapa mental
Wrapper Classes
Conteúdo do mapa
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
Informações
- Descrição
- Computer Science Mapa Mental sobre Wrapper Classes, criado por Tate Johnson em 27-04-2021.
- Criado por
- Tate Johnson
- Visualizações
- 2
- Avaliação