CONTENT
 Introduction
 Hierarchy of Exception
 Types of Java Exceptions
 Java Exception Keywords
 Example
INTRODUCTION
 The Exception Handling in Java is one of the powerful mechanism to
handle the runtime errors so that the normal flow of the application
can be maintained.
What are Exception?
An exception is a problem that arises during the execution of a
program. When an Exception occurs the normal flow of the program
is disrupted and the program terminates abnormally, which is not
recommended, therefore, these exceptions are to be handled.
Hierarchy of Exception
Types Of Exception
There are Three types of Exception
 1. Checked Exception
 2. Unchecked Exception
 3. Error
JAVA EXCEPTION KEYWORD
Here are some java exceptions keywords
1.Try
2.Catch
3.Finally
4. Throw
5. Throws
Example
Example of exception handling in Java:
public class Example {
public static void main(String[] args) {
try {
int[] arr = new int[3];
arr[4] = 5;
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("An array index is out of bounds.");
}
}}
Exception handling ppt.pptx

Exception handling ppt.pptx

  • 2.
    CONTENT  Introduction  Hierarchyof Exception  Types of Java Exceptions  Java Exception Keywords  Example
  • 3.
    INTRODUCTION  The ExceptionHandling in Java is one of the powerful mechanism to handle the runtime errors so that the normal flow of the application can be maintained. What are Exception? An exception is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program terminates abnormally, which is not recommended, therefore, these exceptions are to be handled.
  • 4.
  • 5.
    Types Of Exception Thereare Three types of Exception  1. Checked Exception  2. Unchecked Exception  3. Error
  • 6.
    JAVA EXCEPTION KEYWORD Hereare some java exceptions keywords 1.Try 2.Catch 3.Finally 4. Throw 5. Throws
  • 7.
    Example Example of exceptionhandling in Java: public class Example { public static void main(String[] args) { try { int[] arr = new int[3]; arr[4] = 5; } catch (ArrayIndexOutOfBoundsException e) { System.out.println("An array index is out of bounds."); } }}