Any floating-point literal in Java is by default of a double type. Consider the following codes with compilation error from the Eclipse IDE
To fix this problem, place “f” or “F” at the end of the literal.
float y = 13.1F;
float y2 = 13.1f;
We can assign integral literals to variables of either float or double type without any special suffixes.