Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How does java convert integers into strings and add zeros in front of them?
How does java convert integers into strings and add zeros in front of them?
There are two solutions to this problem.

The first comparison is satisfactory. First, the integer is converted into a string, and then a "0" is added in front of the string. The code is as follows:

int? num? =? 10;

String? str? =? string . value of( 10);

str? =? "0"? +? str

Another clever way is to add plastic numbers directly to strings, and java will automatically splice them into strings.

int? num? =? 10;

String? str? =? "0"? +? num