Hello all, I'm taking an intro to CS class based on Java. A question in the book gives the following declarations:
init iResult, num1=25, num2=40
double fResult, val1=17.0, val2=12.78
and then asks: what result is stored in this assignment statement?
fResult = (int) ((double) num1/num2);
To me, this means that num1 is cast to a double and num2 will have to be a double as well to perform the division (25.0/40.0), answer .63. This is then cast to an integer, making it 1, and then turned into a double again since we're looking for fResult, giving a final answer of 1.0....is this correct?...if not, please point out my error.
Thanks!
-C