Is the result of adding char type and int type in Java char type or int type?
•
Java
At first glance, you may have a question: can these two add up?
The answer is to see the effect:
Seeing this operation effect, I think you feel some of them now
Of course, first of all, we can be sure that these two can be added. Secondly, we should know that they are all basic types. Finally, we need to understand one thing:
"Upward compatibility" -- that is, the data of different data types participate in the operation, the data type shall be forcibly converted, and the conversion direction is
(unsigned)char,(unsigned)short->int->unsigned->long->unsigned long->float->double->longdouble。
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码