Hi. There is a task here on CodeGym that requires to change cast operators to get a desired result. I've solved it but it contains something that I simply don't understand.
The 'd' will yield 2147483647 if 'f' is of type double. If I change to int, it throws ArithmeticException.
double f = (char) 1234.15; long d = (int) (f / c); System.out.println(d);
Why? Can you divide by zero if it's not an int or when you're casting it?
int f = 1234; long d = (int) (f / c); System.out.println(d);