Floating-point Literals

Floating-point literals are used to initialize variables of data type float and double. If a floating-point literal ends with f or F, it's of type float. Otherwise, it's of type double. A double type can optionally end with D or d. However, it's not necessary. They can also be expressed in scientific notation using E or e.


\begin{lstlisting}
class DoubleExample {
public static void main(String[] args)...
...println(myFloat);
System.out.println(myDoubleScientific);
}
}
\end{lstlisting}