0

Why there is 4.2 before the f

15th Jul 2019, 8:50 AM
Pranjal Mandal
Pranjal Mandal - avatar
3 ответов
+ 2
Decimal numbers by default are doubles, but by adding f to the end of the decimal number you tell the program that the decimal number is a float instead. Double and float are both decimal numbers, but they have a difference: Doubles can have 15 decimal places. Floats can have 7 decimal places. 4.2 would be a double 4.2f would be a float
15th Jul 2019, 9:58 AM
Seb TheS
Seb TheS - avatar
+ 1
Thank you jamie
15th Jul 2019, 10:16 AM
Pranjal Mandal
Pranjal Mandal - avatar