If everything is clear with the type for integers long, L is assigned to the literal when you need to enter a number larger than the range of int. And on the account of type float, if we assign a literal to it, it automatically drops from double to float, because the values ​​from float 100% will enter double values, and the question itself, why attribute F to a literal, can you throw some simple example?

  • ATP fixed, did not notice just - Rayhorn

1 answer 1

Just as L separates long from int , F separates float from double .

Just in Java, by default, double selected for floating-point numbers. For example, this will not compile:

 float myFLoat = 1.5; 

Don't add the literal yet:

 float myFLoat = 1.5f; 
  • In general, the rules in Java are. You just need to remember this .. - Drakonoved