🎴 Flashcard Mode

Basics of Exception Handling in Java

Card1 / 14
Mastered0
Review0
QuestionClick to flip

What would be the output of the following program?

Class A {
 public static void main(String args[]) {
  int a = 0;
  int b = 10 / a;
 }
}
AnswerClick to flip back
A
RuntimeException
💡 Explanation:

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

Change Mode