Добавить
Уведомления

Java Exception Handling Part 14

Java Exception handling is used to deal with errors during java program execution so that program can continue processing normally and can recover from the exception or error gracefully. Java has throwable class and Exception and error classes extend from it. The errors during java program such as StackOverflowError and OutOfMemoryError etc are outside the control of developer and should not be handled. Errors indicate a serious problem with the program and normal processing cannot continue. Exceptions are of two types -Checked Exceptions -UnChecked Exceptions Checked Exceptions: These are called compile time exceptions and user is forced to handle these exceptions or throw back them so that higher level callers can handle those. Examples of checked exceptions are IOException. UnChecked Exceptions: These are runtime exceptions and they occur when the program is running. Developer should anticipate these kind of exceptions in the code and take steps to deal with them. Examples of unchecked exceptions include NullPointerException, ArrayIndexOutOfBounds etc. User can also define custom exceptions by extending the Exception class.

12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

Java Exception handling is used to deal with errors during java program execution so that program can continue processing normally and can recover from the exception or error gracefully. Java has throwable class and Exception and error classes extend from it. The errors during java program such as StackOverflowError and OutOfMemoryError etc are outside the control of developer and should not be handled. Errors indicate a serious problem with the program and normal processing cannot continue. Exceptions are of two types -Checked Exceptions -UnChecked Exceptions Checked Exceptions: These are called compile time exceptions and user is forced to handle these exceptions or throw back them so that higher level callers can handle those. Examples of checked exceptions are IOException. UnChecked Exceptions: These are runtime exceptions and they occur when the program is running. Developer should anticipate these kind of exceptions in the code and take steps to deal with them. Examples of unchecked exceptions include NullPointerException, ArrayIndexOutOfBounds etc. User can also define custom exceptions by extending the Exception class.

, чтобы оставлять комментарии