[Solved] Type casting int and double [closed]


To answer your last point which is interesting (the other parts of the question are best answered by a debugger), a double that is too large for an int will cast into the largest possible int; similarly for a double that is too small for an int will cast to the smallest possible int.

See http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#d5e4334

Note that an int is defined in Java as 32 bits (for eternity) and a double is 64 bit (for eternity).

solved Type casting int and double [closed]