Common type of packaging
In java, all the basic data types are packaging
According to the basic data types to create wrapper class object
Format: packaging a data value of type reference name = new type of packaging data (basic data type
According string to create wrapper class object:
Format: data type packaging wrapper class reference name = new data type (String)
Note: the contents of string to the corresponding data type, otherwise there will be java.lang.NumberFormatException (data format abnormal)
For boolean types of packaging, when the content of the string is the true output is true, any characters are not true, the output is false
Character wrapper class can not create an object using a string.
Packaging commonly used methods:
Basic data types Value (): converts wrapper class object basic data types ( except Boolean, char )
parse the data type (String s): may be converted to the basic string data type (character type excluded)
valueOf (): the basic data types to wrapper class object
Boxing and unboxing
Packing: converting the basic data types of packaging objects
Unpacking: the packaging object into basic data types
In Java, packing and unpacking is automatically a