Java learning: why float a = 5.6; compile error ?

why can't float a = 5.6; ?

 error: incompatible types: possible lossy conversion from double to float         float a = 5.6;                   ^ 1 error 

Cause

double is the default type of floating point number in java language.

Fix

 float a = 5.6f; 

Comments

Popular posts from this blog

react-native run-android : sun.security.provider.cert path.SunCertPathBuilderException : unable to find valid certification path to req uested target

react-native run-android : do not build/update modified code(App.js)

How to fix error : no module named sendgrid when try to use sendgrid python lib in PHP.