Multiple choice

What would be the output of the following program?

Class A {
 public static void main(String args[]) {
  int a = 0;
  int b = 10 / a;
 }
}

  1. 0

  2. 10

  3. Infinite

  4. RuntimeException

  5. Compile Time Exception

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

This is the correct answer. This piece of code will result in a RuntimeException. ArithmeticException is the exception that will be thrown.