A char in java is an unsigned 16-bit integer. If you cast a negative integer literal like -1 to a char, then the value is interpreted as a positive number; in this case 65535- or Unicode character \uFFBF.
Check this -1 cast with char only,
System.out.println( (char) -1);
If it cast with int
or byte
type, this returns -1
only.