1. Packaging classes convert basic type data to Objects
1.1 Each base type has a corresponding wrapper class in the Java.lang package
2. What is the role of the packaging class?
2.1 provides a series of practical methods
2.2 Collection is not allowed to hold basic data type data, when storing numbers, use the wrapper type
3. How to construct the packing class
3.1 All wrapper classes can use their corresponding base data types as parameters to construct their instances
Public type (type value)
such as: Integer I=new integer (1);
3.2 In addition to the character class, other wrapper classes can construct their instances with a string as a parameter
Public Type (String value)
such as: Integer i=new integer ("123");
3.3 Precautions:
(1) If the Boolean constructor method parameter is a string type, the string content is
True (regardless of case), the Boolean object represents true, otherwise false is represented.
(2) When the number wrapper class constructs a method parameter of type string, the string cannot be null.
And the string must be resolvable to the data of the corresponding base data type, otherwise compiled through, run-time numberformatexception exception.
Java Wrapper class Introduction (i) (wrapper class, basic type Data)