Home / Questions / What class of exceptions are generated by the Java run-time system?
Explanatory Question

What class of exceptions are generated by the Java run-time system?

👁 928 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

Answer:
The Java run-time system generates unchecked exceptions, which are part of the RuntimeException class and its subclasses.


💡 Explanation:

In Java, exceptions are divided mainly into two categories:

  1. Checked Exceptions — Checked at compile time
    → Example: IOException, SQLException

  2. Unchecked Exceptions — Occur at runtime (not checked by compiler)
    → Example: ArithmeticException, NullPointerException


⚙️ Run-time System Generated Exceptions

These are exceptions automatically thrown by the Java Virtual Machine (JVM) when an error occurs during program execution.
They belong to the RuntimeException class.


🧾 Common Examples Generated by JVM:

Exception Description
ArithmeticException Division by zero
NullPointerException Accessing a method or variable through a null object
ArrayIndexOutOfBoundsException Accessing invalid array index
NumberFormatException Invalid string to number conversion
ClassCastException Invalid type casting

🧠 Summary Sentence:

The Java run-time system generates exceptions that are subclasses of RuntimeException, known as unchecked exceptions.