Floating Point Literals In Java contains the fractional parts. e.g.,
251.73, 3.14, 98766.12, 10E+03, 2.78e-7 . If the Floating Point Literal is suffixed with letter F or f , then it is of type float . So 251.73 is of type double where as 251.73f is of type float .
Floating Point Literals include
float and double Data types. The default data type of Floating Point Literals is double , but you can designate it explicitly by appending the D (or d) suffix. However, the suffix F (or f) is appended to designate the data type of a Floating Point Literal as float . We can also specify a Floating Point Literal in scientific notation using exponent (E or e). Below are few samples on how to convert from the exponential format to decimal format.
0.0314E2 = 0.0314 * 10^2 = 0.0314 * 100 = 3.14 4E+7 = 4 * 10^7 = 4 * 10000000 = 40000000 5.25e-6 = 5.25 / 10^6 = 5.25 / 1000000 = 0.00000525 double d1 = 123.4; // represents d1 as double value
|