JAVA | Exception Handling | Introduction

2 Next Level Developer · Post JAVA | Exception Handling | Introduction Posting as Paritosh Agrawal Update Revert to draft Preview Close ComposeHTML Link
Introduction: An Exception is nothing but an exceptional or unexpected event that may occur during the program execution.

Examples:
  1. Invalid input: ValidationException
  2. File does not exist: FileNotFoundException
Exceptions are categorised into 3 categories.
    1. Checked exceptions
    2. Unchecked exceptions
    3. Errors
Checked exceptions: occurs at the compile time, also called as compile time exceptions. programmer is supposed to handle these exception.
Example: https://ideone.com/80B30I



Unchecked exceptions: occurs at the time of execution, also called as Runtime exceptions. Runtime Exception includes bugs, such as logic errors or improper use of an API.
Example: https://ideone.com/ZqWh7X

Java Exception Hierarchy




Was this article helpful? Please, provide you feedback in comments section below. Please add comments if you find anything wrong or want to add something that will make this article more better.

Thank you for reading :-)

Comments

Popular posts from this blog

IOC(Inversion Of Control)

Design Pattern