Dear all,
Question 8 of dan's mock exam about primitive conversion:
ANswer : false, false, true.
For the two first answers, the key is to know that before to be casted as short type, a float type has to be casted into an int one.
At first glance, it can appear logical.
But what about the third answer, deduced from the fact that apparently, narrowing cast of Float.NaN or Double.NaN gives 0 as result?
Is there a reason for that or is it just a rule we have to learn?
Thanks in advance for your answer,
Cyril.
Question 8 of dan's mock exam about primitive conversion:
ANswer : false, false, true.
For the two first answers, the key is to know that before to be casted as short type, a float type has to be casted into an int one.
At first glance, it can appear logical.
But what about the third answer, deduced from the fact that apparently, narrowing cast of Float.NaN or Double.NaN gives 0 as result?
Is there a reason for that or is it just a rule we have to learn?
Thanks in advance for your answer,
Cyril.