+ 19
Char arithmetic
Can anyone please explain to me what's happening here😨 public class Program { public static void main(String[] args) { char ch = '0'; ch *= 1.1; System.out.println(ch); } } Output: 4
2 odpowiedzi
+ 16
The ASCII value of '0' is 48.
48 * 1.1 = 52.8
52.8 floored (52) and reinterpreted to char is is '4'.
+ 18
@Hatsy Rei
Thanks mate