I was reading the Java Sun Certification Book and one of the sample questions in the first chapter is:
" Which 3 are valid declarations of a float? (Choose 3) A. float f1 = -343; B. float f2 = 3.14; C. float f3 = 0x12345; D. float f4 = 42e7; E. float f5 = 2001.0D; F. float f6 = 2.81F; "
The Book says the answer is A, C, and F. It is clear to me why F is one of the answers since the "F" suffix is attached to the end of the number. It is also clear why A and C are correct based on the explanation at the end of the chapter which says: "A and C are integer literals (32 bits), and integers can be legally assigned to floats (also 32 bits.)"
But what I don't understand is why D is not one of the correct answers, based upon the same logic which makes A and C correct. Specifically, isn't D (42e7) and integer literal as well, making it able to be legally assigned to a float. Since 42e7 represents (240,000,000) , isn't it an int and not a double by default as a literal?