Expressions and Assignment Statements

AP Computer Science A· difficulty 3/5

<code>int x = 5 / 0;</code> causes

  • A

    ArithmeticException at runtime

    check_circle
  • B

    Compile error

  • C

    x = 0

  • D

    x = Infinity

Explanation

Integer division by zero throws <code>ArithmeticException</code> (compiles fine).

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

Related questions