SlideShare a Scribd company logo
1
An Exception is…
An unusual, often unpredictable event,
detectable by software or hardware, that
requires special processing
An exception handler is a section of program
code
that is executed when a particular exception
occurs.
2
Why have exception handlers?
 With no exception handler for an
exception, your program ends at the
point of the exception (with no user
understandable data from the O/S)
 With an exception handler, you can
handle the unusual condition in an
understandable way
3
Try/Catch/Throw
 Try: The block of code monitored for
exceptions
 Catch: The block of code following
the try block handles an exception
type
 Throw: When an exception is
detected, you throw an exception
type
4
The try-catch Statement
try
Block (exception can be thrown within this block
or any called functions)
catch (FormalParameter1)
Block
catch (FormalParameter2)
TryCatchStatement
How one part of the program catches and processes
the exception that another part of the program throws.
FormalParameter
DataType VariableName
…
5
Execution of try-catch
No
statements throw
an exception
Statement
following entire try-catch
statement
A
statement throws
an exception
Exception
Handler
Statements to deal with exception are executed
Control moves
directly to exception
handler
6
O/S (Unix) or you can throw
exceptions
 O/S thrown examples
 No storage available for new
request, divide by zero
 User thrown exceptions
 Using the throw statement

More Related Content

PPTX
Java Exceptions and Exception Handling
MaqdamYasir
 
PPTX
Exception handling in java
ravinderkaur165
 
PPT
Chapter13 exception handling
Prabhakar Nallabolu
 
PPTX
Exception handling in java
Kavitha713564
 
PPTX
Exceptions
Narayana Swamy
 
ODP
Exception Handling In Java 15734
madhurendra pandey
 
PPTX
Exception handling in Java
Ankit Rai
 
PPTX
Exception Handling in Java
lalithambiga kamaraj
 
Java Exceptions and Exception Handling
MaqdamYasir
 
Exception handling in java
ravinderkaur165
 
Chapter13 exception handling
Prabhakar Nallabolu
 
Exception handling in java
Kavitha713564
 
Exceptions
Narayana Swamy
 
Exception Handling In Java 15734
madhurendra pandey
 
Exception handling in Java
Ankit Rai
 
Exception Handling in Java
lalithambiga kamaraj
 

What's hot (13)

PPT
Exception Handling Java
ankitgarg_er
 
ODP
Exception Handling In Java
parag
 
PPTX
Z blue exception
Narayana Swamy
 
PPT
Week7 exception handling
Alpesh Oza
 
ODP
Exception handling in python
baabtra.com - No. 1 supplier of quality freshers
 
PPT
Vc++ 4(exception handling)
Raman Rv
 
PDF
Exception handling
Muthukumaran Subramanian
 
PPT
12 exception handling
Arriz San Juan
 
PDF
Introduction to Exception
Swabhav Techlabs
 
PPTX
What is Exception Handling?
Syed Bahadur Shah
 
PPTX
Exception handling
Abhishek Pachisia
 
PPTX
Introduction to java exceptions
Sujit Kumar
 
PDF
Design byexceptions
Asif Tasleem
 
Exception Handling Java
ankitgarg_er
 
Exception Handling In Java
parag
 
Z blue exception
Narayana Swamy
 
Week7 exception handling
Alpesh Oza
 
Vc++ 4(exception handling)
Raman Rv
 
Exception handling
Muthukumaran Subramanian
 
12 exception handling
Arriz San Juan
 
Introduction to Exception
Swabhav Techlabs
 
What is Exception Handling?
Syed Bahadur Shah
 
Exception handling
Abhishek Pachisia
 
Introduction to java exceptions
Sujit Kumar
 
Design byexceptions
Asif Tasleem
 
Ad

Viewers also liked (20)

PPTX
Ruby on rails evaluation
Luis Goldster
 
PPTX
Cobol, lisp, and python
Luis Goldster
 
PPTX
Αρχιτεκτονικό σχέδιο
mariagian1992
 
PPTX
Mapa de riesgo
orsini07
 
PPTX
Optimizing shared caches in chip multiprocessors
Harry Potter
 
PPTX
Rest api to integrate with your site
Tony Nguyen
 
PDF
AWS ElasticBeansTalk
Ismail JALLOULI
 
PPTX
Api crash
James Wong
 
PPTX
Cache recap
Luis Goldster
 
PPTX
Cache recap
Harry Potter
 
PDF
Estado del recurso suelo en Guatemala, prioridades y necesidades para su mane...
FAO
 
PPTX
Multithreading models.ppt
Luis Goldster
 
PDF
Αναθέσεις Μαθημάτων ΕΠΑΛ - ΦΕΚ 1671 10-06-2016
John Tzortzakis
 
PPTX
Object oriented analysis
Tony Nguyen
 
PPTX
Python language data types
Tony Nguyen
 
PPT
Ψηφιακή Χαρτογραφία & Γεωπληροφορική - 2ο μέρος
John Tzortzakis
 
PPTX
Classification of memory hierarchy in system unit
Deepjyoti Talukdar
 
PPT
pipeline and vector processing
Acad
 
PPT
Parallel computing
Vinay Gupta
 
PDF
11 abstract data types
jigeno
 
Ruby on rails evaluation
Luis Goldster
 
Cobol, lisp, and python
Luis Goldster
 
Αρχιτεκτονικό σχέδιο
mariagian1992
 
Mapa de riesgo
orsini07
 
Optimizing shared caches in chip multiprocessors
Harry Potter
 
Rest api to integrate with your site
Tony Nguyen
 
AWS ElasticBeansTalk
Ismail JALLOULI
 
Api crash
James Wong
 
Cache recap
Luis Goldster
 
Cache recap
Harry Potter
 
Estado del recurso suelo en Guatemala, prioridades y necesidades para su mane...
FAO
 
Multithreading models.ppt
Luis Goldster
 
Αναθέσεις Μαθημάτων ΕΠΑΛ - ΦΕΚ 1671 10-06-2016
John Tzortzakis
 
Object oriented analysis
Tony Nguyen
 
Python language data types
Tony Nguyen
 
Ψηφιακή Χαρτογραφία & Γεωπληροφορική - 2ο μέρος
John Tzortzakis
 
Classification of memory hierarchy in system unit
Deepjyoti Talukdar
 
pipeline and vector processing
Acad
 
Parallel computing
Vinay Gupta
 
11 abstract data types
jigeno
 
Ad

Similar to Exception handling (20)

PPTX
Exception handling with python class 12.pptx
PreeTVithule1
 
PDF
Python Programming - X. Exception Handling and Assertions
Ranel Padon
 
PPTX
Maheen oop
mahshah212
 
PPTX
Lecture 3.1.1 Try Throw Catch.pptx
sunilsoni446112
 
PPTX
Exception handling.pptxnn h
sabarivelan111007
 
PPTX
Python Exceptions Powerpoint Presentation
mitchellblack733
 
PPSX
Exception Handling
Reddhi Basu
 
PPT
Exception
Navaneethan Naveen
 
PPTX
Exception handling in python
Intellipaat
 
PPT
Exceptions in c++
Kuntal Bhowmick
 
PPTX
Java SE 11 Exception Handling
Ashwin Shiv
 
PPT
33aa27cae9c84fd12762a4ecdc288df822623524-1705207147822.ppt
svijaycdac
 
PPT
Exceptionhandling
DrHemlathadhevi
 
PPTX
Exceptions in C++ Object Oriented Programming.pptx
estorebackupr
 
PPTX
presentation-on-exception-handling-160611180456 (1).pptx
ArunPatrickK1
 
PPTX
Exceptions
Narayana Swamy
 
PPTX
exception handling.pptx
AbinayaC11
 
PPTX
Chapter 5
siragezeynu
 
Exception handling with python class 12.pptx
PreeTVithule1
 
Python Programming - X. Exception Handling and Assertions
Ranel Padon
 
Maheen oop
mahshah212
 
Lecture 3.1.1 Try Throw Catch.pptx
sunilsoni446112
 
Exception handling.pptxnn h
sabarivelan111007
 
Python Exceptions Powerpoint Presentation
mitchellblack733
 
Exception Handling
Reddhi Basu
 
Exception handling in python
Intellipaat
 
Exceptions in c++
Kuntal Bhowmick
 
Java SE 11 Exception Handling
Ashwin Shiv
 
33aa27cae9c84fd12762a4ecdc288df822623524-1705207147822.ppt
svijaycdac
 
Exceptionhandling
DrHemlathadhevi
 
Exceptions in C++ Object Oriented Programming.pptx
estorebackupr
 
presentation-on-exception-handling-160611180456 (1).pptx
ArunPatrickK1
 
Exceptions
Narayana Swamy
 
exception handling.pptx
AbinayaC11
 
Chapter 5
siragezeynu
 

More from James Wong (20)

PPT
Data race
James Wong
 
PPT
Multi threaded rtos
James Wong
 
PPT
Recursion
James Wong
 
PPTX
Business analytics and data mining
James Wong
 
PPTX
Data mining and knowledge discovery
James Wong
 
PPTX
Cache recap
James Wong
 
PPTX
Big picture of data mining
James Wong
 
PPTX
How analysis services caching works
James Wong
 
PPTX
Optimizing shared caches in chip multiprocessors
James Wong
 
PPTX
Directory based cache coherence
James Wong
 
PPT
Abstract data types
James Wong
 
PPTX
Abstraction file
James Wong
 
PPTX
Hardware managed cache
James Wong
 
PPTX
Object model
James Wong
 
PPT
Abstract class
James Wong
 
PPTX
Object oriented analysis
James Wong
 
PPTX
Concurrency with java
James Wong
 
PPTX
Data structures and algorithms
James Wong
 
PPTX
Cobol, lisp, and python
James Wong
 
PPTX
Inheritance
James Wong
 
Data race
James Wong
 
Multi threaded rtos
James Wong
 
Recursion
James Wong
 
Business analytics and data mining
James Wong
 
Data mining and knowledge discovery
James Wong
 
Cache recap
James Wong
 
Big picture of data mining
James Wong
 
How analysis services caching works
James Wong
 
Optimizing shared caches in chip multiprocessors
James Wong
 
Directory based cache coherence
James Wong
 
Abstract data types
James Wong
 
Abstraction file
James Wong
 
Hardware managed cache
James Wong
 
Object model
James Wong
 
Abstract class
James Wong
 
Object oriented analysis
James Wong
 
Concurrency with java
James Wong
 
Data structures and algorithms
James Wong
 
Cobol, lisp, and python
James Wong
 
Inheritance
James Wong
 

Recently uploaded (20)

PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Software Development Methodologies in 2025
KodekX
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Doc9.....................................
SofiaCollazos
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
The Future of Artificial Intelligence (AI)
Mukul
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 

Exception handling

  • 1. 1 An Exception is… An unusual, often unpredictable event, detectable by software or hardware, that requires special processing An exception handler is a section of program code that is executed when a particular exception occurs.
  • 2. 2 Why have exception handlers?  With no exception handler for an exception, your program ends at the point of the exception (with no user understandable data from the O/S)  With an exception handler, you can handle the unusual condition in an understandable way
  • 3. 3 Try/Catch/Throw  Try: The block of code monitored for exceptions  Catch: The block of code following the try block handles an exception type  Throw: When an exception is detected, you throw an exception type
  • 4. 4 The try-catch Statement try Block (exception can be thrown within this block or any called functions) catch (FormalParameter1) Block catch (FormalParameter2) TryCatchStatement How one part of the program catches and processes the exception that another part of the program throws. FormalParameter DataType VariableName …
  • 5. 5 Execution of try-catch No statements throw an exception Statement following entire try-catch statement A statement throws an exception Exception Handler Statements to deal with exception are executed Control moves directly to exception handler
  • 6. 6 O/S (Unix) or you can throw exceptions  O/S thrown examples  No storage available for new request, divide by zero  User thrown exceptions  Using the throw statement