When you are somewhat chartogether, they are upgraded toint .
The value int '3'is 51 (the ASCII value, as specified in JLS Sec 3.1 , the first 128 characters of the UTF-16 encoding is the same as the ASCII characters).
So '3' * '3' * '3' == 51 * 51 * 51 == 132651.
But 132651too large to embed it in charwhen pressed; so it overflows (twice, starting at Character.MAX_VALUE == 65535) and you get the value
(char) (c * c * c)
== (char) 132651
== (char) (132651 % 65536)
== (char) 1579
== 'ث'
cube int ( long) result; int, : , , char. :
Cubed 'char' = 1579
.
, result:
System.out.println("Cubed 'char' = " + cube(ch));
Cubed 'char' = ث
Ideone demo