java - precision error in output -


this question has answer here:

double x = 9/2 //x == 4.0? 

the output should 4.5, 4.0 mistake made?

9/2 <- without decimal specify int

9.0 / 2.0 <- double , should able 4.5


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -