2
Most read
3
Most read
8
Most read
www.java2blog.com
EXCEPTION HANDLING
CONTENT
Introduction
Types of Exception Handling
try block
catch block
finally block
throw vs throws
INTRODUCTION
An exception is an abnormal condition which occurs
during the execution of a program. To handle the
Exception we use exception handling mechanism.
Exception handling helps to maintain the normal flow
of execution of an application.
TYPES OF EXCEPTION
An exception that is checked at compile time is
known as checked Exceptions. Examples of
Checked Exception are IOException,
SQLException, ClassNotFoundException.
Checked Exception:
TYPES OF EXCEPTION
An exception that is not checked at compile time is
known as an unchecked exception. Examples of
Unchecked Exception are ArithmeticException,
NullPointerException, NumberFormatException.
Unchecked Exception:
TYPES OF EXCEPTION
Errors are irrecoverable.
Exa- VirtualMachineError,
StackOverFlowError,
OutOfMemoryError.
Error:
TRY BLOCK
It must be followed either by finally block or
Catch block.
It must be used within a method.
Try block is used to wrap the code that may throw
an exception.
CATCH BLOCK
A catch block can be used only after the try
block.
All the catch block must be ordered from subclass
exception to super class exception.
The catch block is used to handle the exception.
multiple catch block can be within a single try block.
FINALLY BLOCK
We put the cleanup code into the finally
block like closing a file.
A finally block will not execute only when If the
program terminates through System.exit() or If
causing a fatal error.
A finally block is executed always whether the
exception is handled or not.
THROW VS THROWS
throws keyword is used to declare an exception. It
provides information to the programmer that there may
occur an exception so It is programmer’s responsibility
to provide exception handler so that the normal flow of
application can be maintained
throw keyword is used to explicitly throw an exception.
It is generally used to throw a custom exception (User
defined exception). It is used within a method body.
www.java2blog.com
THANK YOU

More Related Content

PPTX
Presentation on-exception-handling
PPS
Java Exception handling
PPTX
Exception handling in java
PDF
Project charter and plan document for millennium upgrade
PPTX
Introduction to JUnit
PPTX
Exception Handling in Java
PPTX
Introduction to Selenium Web Driver
PPTX
Test Automation and Selenium
Presentation on-exception-handling
Java Exception handling
Exception handling in java
Project charter and plan document for millennium upgrade
Introduction to JUnit
Exception Handling in Java
Introduction to Selenium Web Driver
Test Automation and Selenium

What's hot (20)

PDF
Arrays in Java
PPTX
Java exception handling
PPTX
Exceptionhandling
PPTX
Exception handling in Java
PDF
Java exception handling ppt
PPT
Exception handling in java
PDF
Enumeration in Java Explained | Java Tutorial | Edureka
PPTX
This keyword in java
PPT
Exception handling
PPSX
Exception Handling
PPT
Exception Handling in JAVA
PPTX
Exception handling in java
PPTX
Java swing
PPTX
Control statements in java
PPTX
Interface in java
PPT
C# Exceptions Handling
PPT
sets and maps
PPTX
Event handling
PPT
Java awt
Arrays in Java
Java exception handling
Exceptionhandling
Exception handling in Java
Java exception handling ppt
Exception handling in java
Enumeration in Java Explained | Java Tutorial | Edureka
This keyword in java
Exception handling
Exception Handling
Exception Handling in JAVA
Exception handling in java
Java swing
Control statements in java
Interface in java
C# Exceptions Handling
sets and maps
Event handling
Java awt
Ad

Similar to Exception Handling in Java (20)

PPTX
Exception Handling.pptx
PPTX
Lec-01 Exception Handling in Java_javatpoint.pptx
PPTX
OBJECT ORIENTED PROGRAMMING_Unit3_NOTES first half.pptx
PPTX
Exception handling in java
PPT
exception handling in java.ppt
PPT
oop-unit-iii-ppt.pptexceptionhandlingobjectorientedprogramming
PPTX
UNIT-3.pptx Exception Handling and Multithreading
DOCX
VTU MCA 2022 JAVA Exceeption Handling.docx
PPTX
Exception Handling Multithreading: Fundamental of Exception; Exception types;...
PDF
Ch-1_5.pdf this is java tutorials for all
PPTX
Module 4.pptx for vtu atonumous for 3rd sem
PPTX
unit 4 msbte syallbus for sem 4 2024-2025
PPTX
Exception handling in java
PDF
Exception handling basic
PPT
Exceptionhandling
PPTX
Exception handling in java.pptx
PPTX
Exception handling in java
PPTX
Exceptions overview
PPTX
Exception Handling s the process of responding to unwanted or unexpected even...
PPT
Exception handling
Exception Handling.pptx
Lec-01 Exception Handling in Java_javatpoint.pptx
OBJECT ORIENTED PROGRAMMING_Unit3_NOTES first half.pptx
Exception handling in java
exception handling in java.ppt
oop-unit-iii-ppt.pptexceptionhandlingobjectorientedprogramming
UNIT-3.pptx Exception Handling and Multithreading
VTU MCA 2022 JAVA Exceeption Handling.docx
Exception Handling Multithreading: Fundamental of Exception; Exception types;...
Ch-1_5.pdf this is java tutorials for all
Module 4.pptx for vtu atonumous for 3rd sem
unit 4 msbte syallbus for sem 4 2024-2025
Exception handling in java
Exception handling basic
Exceptionhandling
Exception handling in java.pptx
Exception handling in java
Exceptions overview
Exception Handling s the process of responding to unwanted or unexpected even...
Exception handling
Ad

More from Java2Blog (7)

PDF
Java interview questions
PDF
Core Java Tutorial
PDF
Java String
PDF
Polymorphism in Java
PDF
Spring Tutorial for Beginners
PDF
Web Service Tutorial
PDF
How to Learn Java Programming
Java interview questions
Core Java Tutorial
Java String
Polymorphism in Java
Spring Tutorial for Beginners
Web Service Tutorial
How to Learn Java Programming

Recently uploaded (20)

PDF
BÀI GIẢNG POWER POINT TIẾNG ANH 6 - I LEARN SMART WORLD - CẢ NĂM - NĂM 2025 (...
PDF
Jana Ojana 2025 Prelims - School Quiz by Pragya - UEMK Quiz Club
PDF
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
PDF
Financial Reporting and Analysis Using Financial Accounting Information by Ch...
PPTX
Entrepreneurship Management and Finance - Module 1 - PPT
PDF
Developing speaking skill_learning_mater.pdf
PDF
3-Elementary-Education-Prototype-Syllabi-Compendium.pdf
PDF
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
PPTX
Environmental Sciences and Sustainability Chapter 2
PDF
Physical pharmaceutics two in b pharmacy
PDF
Teacher's Day Quiz 2025
PDF
GSA-Past-Papers-2010-2024-2.pdf CSS examination
PDF
17649-Learning By Doing_text-tailieu.pdf
PPTX
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
PDF
HSE and their team are going through the hazards of the issues with learning ...
PDF
IS1343_2012...........................pdf
PDF
Global strategy and action plan on oral health 2023 - 2030.pdf
DOCX
OA 7- Administrative Office Procedure and Management.docx
PDF
2003-theological-education-v39-n1-tai lieu
PDF
IDA Textbook Grade 10 .pdf download link if 1st link isn't working so hard to...
BÀI GIẢNG POWER POINT TIẾNG ANH 6 - I LEARN SMART WORLD - CẢ NĂM - NĂM 2025 (...
Jana Ojana 2025 Prelims - School Quiz by Pragya - UEMK Quiz Club
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
Financial Reporting and Analysis Using Financial Accounting Information by Ch...
Entrepreneurship Management and Finance - Module 1 - PPT
Developing speaking skill_learning_mater.pdf
3-Elementary-Education-Prototype-Syllabi-Compendium.pdf
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
Environmental Sciences and Sustainability Chapter 2
Physical pharmaceutics two in b pharmacy
Teacher's Day Quiz 2025
GSA-Past-Papers-2010-2024-2.pdf CSS examination
17649-Learning By Doing_text-tailieu.pdf
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
HSE and their team are going through the hazards of the issues with learning ...
IS1343_2012...........................pdf
Global strategy and action plan on oral health 2023 - 2030.pdf
OA 7- Administrative Office Procedure and Management.docx
2003-theological-education-v39-n1-tai lieu
IDA Textbook Grade 10 .pdf download link if 1st link isn't working so hard to...

Exception Handling in Java

  • 2. CONTENT Introduction Types of Exception Handling try block catch block finally block throw vs throws
  • 3. INTRODUCTION An exception is an abnormal condition which occurs during the execution of a program. To handle the Exception we use exception handling mechanism. Exception handling helps to maintain the normal flow of execution of an application.
  • 4. TYPES OF EXCEPTION An exception that is checked at compile time is known as checked Exceptions. Examples of Checked Exception are IOException, SQLException, ClassNotFoundException. Checked Exception:
  • 5. TYPES OF EXCEPTION An exception that is not checked at compile time is known as an unchecked exception. Examples of Unchecked Exception are ArithmeticException, NullPointerException, NumberFormatException. Unchecked Exception:
  • 6. TYPES OF EXCEPTION Errors are irrecoverable. Exa- VirtualMachineError, StackOverFlowError, OutOfMemoryError. Error:
  • 7. TRY BLOCK It must be followed either by finally block or Catch block. It must be used within a method. Try block is used to wrap the code that may throw an exception.
  • 8. CATCH BLOCK A catch block can be used only after the try block. All the catch block must be ordered from subclass exception to super class exception. The catch block is used to handle the exception. multiple catch block can be within a single try block.
  • 9. FINALLY BLOCK We put the cleanup code into the finally block like closing a file. A finally block will not execute only when If the program terminates through System.exit() or If causing a fatal error. A finally block is executed always whether the exception is handled or not.
  • 10. THROW VS THROWS throws keyword is used to declare an exception. It provides information to the programmer that there may occur an exception so It is programmer’s responsibility to provide exception handler so that the normal flow of application can be maintained throw keyword is used to explicitly throw an exception. It is generally used to throw a custom exception (User defined exception). It is used within a method body.