Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+17 votes

double grade = 2.7;
grade = Math.round(grade);

the answer is 3.0 but I thought it will be 3 because it is Math.round will return an integer. Why is it 3.0?

asked in CSC211_Winter2018 by (8 points)

1 Answer

+10 votes

The variable "grade" is a double so even if it is set to an integer, the integer will be turned into a double.

answered by (8 points)

thank you