ICSE Class 10 Computer Applications
Question 17 of 76
Revising Basic Java Concepts — Question 21
Back to all questions 21
Question Question 14(e)
State the value and type of each expression.
Math.round(3.499)The output value is 3. The type of expression is long.
Explanation
Math.round() rounds off its argument to the nearest mathematical integer. If argument is float, return type is int, if argument is double, return type is long. In this case, 3.499 will be treated as double because suffix 'f' is not there. Hence, it will return a value of long data type.