Multiple choice

What is the value of (int) Math.abs((double) 5 / -4 )?

  1. 1

  2. 2

  3. 1.00

  4. 1.25

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

First, (double) 5 / -4 evaluates to -1.25 because casting 5 to a double forces floating-point division. Next, Math.abs(-1.25) returns 1.25. Finally, casting 1.25 to an int truncates the decimal part, resulting in 1.