It's a 16-bit Unicode character. The minimum value of the char data type is
(0). The maximum value of the char data type is
. Default value is
.
You get the output Q because the Unicode value of Q is
. Here is another example:
When you print
, you will get 9 because
is assigned character '9'. When you print
, you get A because the ASCII value of 'A' is 65. It's because java compiler treats the character as an integral type.