Expressions and Assignment Statements

AP Computer Science A· difficulty 4/5

Comparing <code>double</code> values with <code>==</code> is

  • A

    Always reliable

  • B

    Same as comparing ints

  • C

    Compile error

  • D

    Risky due to round-off — prefer Math.abs(a - b) < ε

    check_circle

Explanation

Floating point round-off can break equality; check within tolerance.

Want 10 more like this — adaptive to your weak spots?

Related questions