Expressions and Assignment Statements

AP Computer Science A· difficulty 4/5

<code>int a = 5; double b = a / 0;</code> results in

  • A

    ArithmeticException at runtime (integer division)

    check_circle
  • B

    Compile error

  • C

    5.0

  • D

    Infinity

Explanation

Right side evaluates as int/int division by 0 first → ArithmeticException.

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

Related questions