Explore BrainMass

JAVA Programming : Float

What value will z have if you execute the following assignment statement?
float z= 5/10.

The answer is 0. Why?

Solution Preview

Because Java consider the two literals 5 and 10 to be integers. The integer operation "/" is different from ...

Solution Summary

Use of "float" in Java programs are investigated. The solution is detailed and well presented. The response received a rating of "5/5" from the student who originally posted the question.