Help with valid declarations of a float
Hi, Ok please can someone explain if the value 3.14 is a double or a float...I am looking at this Java Sun Certification book and it says that 3.14 is a float and not a double.
The question is as follows:
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;
I chose the answers to be A, B and F. The book says A, C and F. Can someone explain this to me? I mean I am leaning towards the I am wrong but the book is right kind of deals but something tells me I am right and the book wrong.
Thanks.