KnowledgeBoat Logo

Computer Applications

Which of the following mathematical methods returns only an integer?

  1. Math.ceil(n)
  2. Math.sqrt(n)
  3. Math.floor(n)
  4. Math.round(n)

Java Math Lib Methods

ICSE 2024

5 Likes

Answer

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).

Answered By

4 Likes


Related Questions