1(xx)
Which of the following mathematical methods returns only an integer?
- (a)Math.ceil(n)
- (b)Math.sqrt(n)
- (c)Math.floor(n)
- (d)Math.round(n)
Show SolutionHide Solution↓
Math.round(n)
Reason — In Java, Math.round(n) is the only method in the list that returns an integer when called with a floating-point number (float or double).