Which of the following exception is thrown when a divide by zero statement is executed?

Java MCQ: Which of the following exception is thrown when a divide by zero statement is executed?

a) ArithmeticException
b) NullPointerException
c) IOException
d) ClassNotFoundException

Answer:

a) ArithmeticException

Explanation:

In Java, ArithmeticException is thrown when an exceptional arithmetic condition occurs, such as dividing by zero. This is a common runtime exception that does not require explicit handling by the programmer.

Reference links:

https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top