//The first method is the simplest.
str = I+" ";
system . out . println(" str = "+str ");
//The second method
Integer it = new integer (i);
str = it . tostring();
system . out . println(" str = "+str ");
//The third method
str = integer . tostring(I);
system . out . println(" str = "+str ");
//The fourth method
str = string . value of(I);
system . out . println(" str = "+str ");
Integer usage
Data type conversion
1) Integer type to character type: (Int type cannot be directly converted into character type, and must be modified into intrger type before conversion).
For example: int a =123;
The first method:? string b = integer . tostring(a);
It means to change a into an integer first, and then convert it into a character type.
The second method: string b = string.valueof (a);
Directly use the method in String to directly convert. String.valueOf () can be applied to any data type without exception.
2 From character type to integer type: string c = "123";
Method1:int d = integer.valueof (c);
Method 2: int d = integer.parseint (c);
To convert a string into a basic data type (int), it is required that the string must be in a number format.
Function: splicing of strings;
" 123"+"456"= 123456;
But an integer is the addition of two numbers;
At first, I didn't understand the difference between his 1234 and the types of numbers and characters, and then I gradually understood it when I applied it.