Multiple choice technology programming languages

The following code is compiled: double abc = 100.0; double xyz = abc/0; What is the result?

  1. Compilation Error

  2. Arithmetic Exception

  3. Compiles with no errors

  4. None of the above

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

In Java, dividing a floating-point number (double) by zero does not throw an ArithmeticException. Instead, it evaluates to Double.POSITIVE_INFINITY and compiles and runs without errors.