Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to convert int to string in java?
How to convert int to string in java?

The methods for converting java int type to String type include: using int i+"", using String.valueOf(), and you can also directly force type conversion.

The specific conversion steps are as follows:

1. First open the software eclipse;

2. We can use int i+""; to complete the conversion, that is Any number + "" a string is equal to a string;

3. You can also use the type conversion method String.valueOf() and put the object to be converted in the brackets. For example: boolean bool = true;String s = String.valueOf(bool);

4. You can also directly force type conversion, such as int MyInt = 1234; String MyString = "" + MyInt; that is, when you want Just add a parenthesis in front of the converted object and put the converted type inside the parentheses.