Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to convert objects into plastics with java?
How to convert objects into plastics with java?
There are three ways to convert an object type to an int type:

1. If the object is generated by byte, short, int and char types, then directly assign the value without conversion.

2. If the object is generated by String type, first convert the object to String type, and then convert the string type to int type.

For example:

string myInt = " 123 ";

Object os = myInt

int b = integer . parse int((String)OS); //You can also use os.toString ().

3. If the object is generated by float, double and long long types, the idea is the same as above. First, the object is converted to the corresponding data type, and then to the int type.