+ 1
Is float d=6; correct in java?
2 Answers
+ 19
yes , thats correct
//as there will be no loss in precision of value
//but in case of double to float there is loss of precision
//loss of precision when higher datatyoe to lower datatype
https://www.sololearn.com/Discuss/1158466/?ref=app
+ 4
Absolutely, the compiler automatically converts 6 to 6.0, which is then a floating-point number!
You can use System.out.print(d); for a better understanding ;)