1) ArithmeticException will occur after execution of the following code int i = 10; float f = 0.0; double d = i/f;
NO. this is the answer and i can't understand it .i think that float f is 0 so divide by zero give arithmetic exception. may be this answer is becoz it give runtime error not exception am i right? ronak please help.
In theory 0.0f is a rounding of some number with a zillion decimal places but that is not necessarily zero. Therefore the division is legal, just results in a VERY SMALL or VERY LARGE numbers. That is why the answer comes back as POSITIVE_INFINITY.
"JavaRanch, where the deer and the Certified play" - David O'Meara