Multiple choice technology programming languages

Following code will result in: int a = 9/0;

  1. Compilation error: Divisions must be in a try block.

  2. Compilation error: DivideByZeroException

  3. Runtime Exception - correct answer

  4. No Error: a is NaN

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

In Java, division of integers by zero evaluates at runtime, throwing an ArithmeticException (a subclass of RuntimeException). It compiles successfully because the compiler does not evaluate division by zero. Java does not have a DivideByZeroException class.