Computer Applications

The output of Math.max(-7, Math.min(-5, -4)) is:

  1. -5
  2. -4
  3. -7
  4. error

Java Math Lib Methods

5 Likes

Answer

-5

Reason — The method Math.min(-5, -4) returns the smaller of the two values, which is -5. Then, Math.max(-7, -5) returns the greater of the two values, which is -5. Hence, the final output of Math.max(-7, Math.min(-5, -4)) is -5.

Answered By

2 Likes


Related Questions