NoFloatLiterals

Misconception:

Java does not provide a way to directly write numbers of type float. Values of type float can only be created by casting, e.g., (float)3.14.

Incorrect

There are no float literals

Correct

An F or f suffix can turn a number into a float literal

Correction
Here is what's right.

Java does have float literals. The suffix f or F denotes a float literal. Examples of float literals in Java:

1f
3.0F

Symptoms
How do you know your students might have this misconception?

The following code snippet shows how this misconception can manifest itself:

float f = (float)3.5;

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.