volume_mute

What is the difference between float and double data types in Java?

publish date2020/09/16 01:01:00 GMT+10

volume_mute
float is a decimal number and double is not
float can be used inside classes but double cannot
float provides less decimal points than double
float cannot be passed as a variable to method but double could be

Correct Answer

float provides less decimal points than double

Explanation

Both double and float data type are used to represent floating point numbers in Java, a double data type is more precise than float. A double variable can provide precision up to 16 decimal points as compared to float precision of 7 decimal digits.

Reference

www.educba.com


Quizzes you can take where this question appears