Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to Convert String Type to Decimal Type
How to Convert String Type to Decimal Type
1. Open the java development tool, create a new java project, and then create a java class in the project. Here I created a class with the main function to facilitate the following demonstration, as shown in the figure below.

Conversion from 2.int type to String type 1: It is realized by using the valueOf () that comes with the java String class.

3. Write an output statement, input the types of variables S and S to determine whether it is correct, and then click Run, and the running result is correct, as shown in the figure below.

Conversion from 4.int type to String type 2: Using java's operation rules, add variables of int type and String type, and java will be converted to Sting type by default. So just add an empty string after int. As shown in the figure below.

5. Write an output statement in the same way, input the types of variables S and S to determine whether it is correct, and then click Run, and the running result will be correct, as shown in the following figure.