🔥 Java Exception and Error Handling
Java Exceptions and Errors Java Exceptions and Errors ⚠️ What is an Exception? An exception is an event that disrupts the normal flow of a program. It occurs during runtime and is recoverable . Example: Dividing by zero, accessing an invalid array index. ❌ What is an Error? An error is a serious issue beyond the control of the application. Typically unrecoverable and leads to program termination. Example: Hardware failure, memory issues, JVM crash. 🌳 Java Exception Hierarchy All exceptions and errors inherit from the Throwable class: Throwable ├── Exception → Can be handled by code │ ├── Checked → Must be handled │ └── Unchecked → Optional to handle └── Error → Cannot/should not be handled 🧱 Types of Exceptions ✅ Built-in Exceptions Predefined by Java. Handle common runtime issues. Examples: NullPointerException , IOException , ArrayIndex...