char b =(char)22545;
system . out . println(b);
2. Convert the Chinese word "one" into an int type, and then run it. The result of the console is 19968.
Int b = ' one
system . out . println(b);
Extended data:
1, literal value assignment
In the process of assigning integer with literal value, you can assign int literal to byte short char int as long as it is within the range. The type conversion in this process is done automatically, but if you try to assign a long word to a byte, you must perform a forced type conversion even if it is not out of range. For example, byte b =10l; ; Is wrong, it needs to be cast.
2. Automatic type promotion in expressions
In addition to assignment, some type conversions may occur during expression evaluation. In the expression, the rules for type promotion are as follows:
All byte/short/char are promoted to int.
If one operand is long, the whole expression is promoted to long. The same is true for floating-point and double-precision types.