Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How does java convert objecet type into plastic?
How does java convert objecet type into plastic?
since it is an object type, you should also treat the object as a whole.

an object is constructed by attributes, methods, etc. If it is mandatory to convert other types,

the first thing to consider is to convert to a certain attribute of its object, not to the whole object.

for example:

Object ob=new Object ();

ob.name="air Qiao";

ob.age=63;

ob.flag=true;

ob.lengt="2"

Here is an object, and its object contains name, age, flag and lengt

, which can also be compared to the corresponding types of string, int, Boolean and string

. If you want to transfer the attributes in the object, it is equivalent to doing actions for a single extracted variable.

so now that you see that both name and lengt are strings, you can set up an int type.

You want to convert the string in the object name into a number. Similarly, lengt itself is a number type of a character.

No matter how you convert it, the premise is to consider the type. It is not impossible to convert the whole object into a number. You can extract the attribute once and then superimpose it according to your own definition. The answer is

. ! !