Wrapper class, basic data type, string conversion between each other
Each base data type has a corresponding wrapper type
wrapper classes, basic data types, and string conversions between the three are important when converting between them;
One, String to other
string→ Package Type
1, Integer (String str)
Call the wrapper class with a string parameter construct
string→ Basic data types
☆string→int calling the parseint method of the wrapper class
Second, packaging class to other
→string
Call the ToString method of the wrapper class object
→ Basic types
① calling the Xxxvalue method of the wrapper class
Methods of wrapping classes, related to objects, non-static, without reference
After ②jdk1.5, direct assignment
int i = Integer
Since unpacking
III. basic data types transfer to other
→string
①5 + ""
②str = integer.tostring (i);
Using the parameter tostring method of the wrapper class
→ Packaging
① calling the construct of the wrapper class new
After ②jdk1.5, direct assignment =
Automatic Seal box
Object obj = 10;
This is also an automatic enclosure, which refers to the parent class's reference to the Child class object
integertest
3.6 complement