Why does the following code not generate an error?
System.out.println((char) 2147483647);
According to oracle datatypes, the maximum size for a char
is 65,535
.
- char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).