Good explanation, Paul. But the point is if
test takers encounter two options in the actually exam that are opposed to each other, like the example above, which one should they choose?
Say, one option claims that "an instance variable of type
float defaults to
0.0f", while the other one claims that "an instance variable of type
float defaults to
0.0", definitely the former one is the correct answer.
But if one option claims that "an instance variable of type
float defaults to
0", while the other one claims that "an instance variable of type
float defaults to
0.0", then the latter one should be the correct answer.
But if there is another option "neither is correct", should test takers choose this one instead of the option claiming "an instance variable of type
float defaults to
0.0"? Interesting.
A recap for new learners regarding to assignment for
double and
float variables.