Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+17 votes

double grade = 2.7;
Math.round(grade);
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 (1 point)

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 (1 point)
+5

thank you

...