SlideShare a Scribd company logo
Maheen oop
MAHEEN
ROLL# 1495
TOPIC:-
EXCEPTION & EXCEPTION
HANDLING
An Exception is a problem that arises during the execution
of a program.
C++ exception is a response to an exceptional
circumstances that arises while a program is running.
E.G. An attempt to divide by zero.
This disrupts the normal flow of the program’s instructions
when an error occurs within a method the method creates
an object and hands it off to the runtime system.
What is exception?
Programmers use design reviews and exhaustive testing to find logic errors.
Exceptions are different, however.You can’t eliminate exceptional
circumstances; you only can prepare for them.
Programs can respond to the errors, using one of following approaches.
1. Crash the program.
2. Inform the user and exit gracefully.
3. Inform the user and allow the user to try to recover and continue.
4. Take corrective action and continue without disturbing the user.
Although it is not necessary or even desirable for every program you write
to automatically and silently recover from all exceptional
circumstances, it is clear that you must do better than crashing.
Handling Unexpected errors:
The process of exception handling allows us to
treat problems that can occur in a program in a
more organized way.The advantage of exception
handling is a higher automation code.
Exception handling is made by try and catch
blocks and can be thrown by throw.
Exceptional Handling:-
Maheen oop
Try – detects the part of the code where we are
looking for exceptions,
Catch – is used to determine the type of
exceptions and how the caught exceptions
will be handled
throw – it can be called from anywhere in the
program code in a try ...
If an error is thrown and not caught in a try ...
catch block it will cause an abrupt
termination of the program
1. Writing a simple try-catch
Maheen oop
Maheen oop
Maheen oop

More Related Content

PPTX
Exception handling
PDF
Introduction to Exception
PPTX
Exception handling in Java
PDF
Exception handling
PPT
Chapter13 exception handling
PPTX
Java Exceptions and Exception Handling
PDF
Exception handling basic
PPTX
Exception handling in java
Exception handling
Introduction to Exception
Exception handling in Java
Exception handling
Chapter13 exception handling
Java Exceptions and Exception Handling
Exception handling basic
Exception handling in java

What's hot (6)

PPTX
CHAPTER 4- Lesson C
PPS
Care Of A Computer
PPTX
Introduction to exception handling in apex
PPTX
It troubleshooting - Arthur B
PPTX
Exception handling in java
PDF
summarizer16fev16_Exceptions
CHAPTER 4- Lesson C
Care Of A Computer
Introduction to exception handling in apex
It troubleshooting - Arthur B
Exception handling in java
summarizer16fev16_Exceptions
Ad

Similar to Maheen oop (20)

PPTX
Exception handling in java
PDF
Exception-Handling.pdf05g830mp6m@freeml.net
PPT
Lecture 22 - Error Handling
PPTX
Exception Handling in UiPath.pptx
PPTX
Java Exception Handling and examples about it
PDF
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
PPT
VBscript
PPTX
Lecture 1 Try Throw Catch.pptx
PPTX
Lecture 20-21
PPT
Exception handling
PPTX
Lecture 3.1.1 Try Throw Catch.pptx
PPTX
Exception handling
PPTX
Exception-Handling-in-Java-A-Comprehensive-Guide (1).pptx
PPTX
Debugging
PDF
CS3391 -OOP -UNIT – III NOTES FINAL.pdf
PPTX
Debugging
PPTX
6-Error Handling.pptx
PPTX
Exception handling
PPTX
Exception handling
PPTX
Exception handling
Exception handling in java
Exception-Handling.pdf05g830mp6m@freeml.net
Lecture 22 - Error Handling
Exception Handling in UiPath.pptx
Java Exception Handling and examples about it
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VBscript
Lecture 1 Try Throw Catch.pptx
Lecture 20-21
Exception handling
Lecture 3.1.1 Try Throw Catch.pptx
Exception handling
Exception-Handling-in-Java-A-Comprehensive-Guide (1).pptx
Debugging
CS3391 -OOP -UNIT – III NOTES FINAL.pdf
Debugging
6-Error Handling.pptx
Exception handling
Exception handling
Exception handling
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
A comparative analysis of optical character recognition models for extracting...
PPT
Teaching material agriculture food technology
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Cloud computing and distributed systems.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
The AUB Centre for AI in Media Proposal.docx
A comparative analysis of optical character recognition models for extracting...
Teaching material agriculture food technology
Programs and apps: productivity, graphics, security and other tools
Cloud computing and distributed systems.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectroscopy.pptx food analysis technology
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Weekly Chronicles - August'25-Week II
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Review of recent advances in non-invasive hemoglobin estimation
“AI and Expert System Decision Support & Business Intelligence Systems”
Diabetes mellitus diagnosis method based random forest with bat algorithm
MIND Revenue Release Quarter 2 2025 Press Release
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
sap open course for s4hana steps from ECC to s4
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Maheen oop

  • 4. An Exception is a problem that arises during the execution of a program. C++ exception is a response to an exceptional circumstances that arises while a program is running. E.G. An attempt to divide by zero. This disrupts the normal flow of the program’s instructions when an error occurs within a method the method creates an object and hands it off to the runtime system. What is exception?
  • 5. Programmers use design reviews and exhaustive testing to find logic errors. Exceptions are different, however.You can’t eliminate exceptional circumstances; you only can prepare for them. Programs can respond to the errors, using one of following approaches. 1. Crash the program. 2. Inform the user and exit gracefully. 3. Inform the user and allow the user to try to recover and continue. 4. Take corrective action and continue without disturbing the user. Although it is not necessary or even desirable for every program you write to automatically and silently recover from all exceptional circumstances, it is clear that you must do better than crashing. Handling Unexpected errors:
  • 6. The process of exception handling allows us to treat problems that can occur in a program in a more organized way.The advantage of exception handling is a higher automation code. Exception handling is made by try and catch blocks and can be thrown by throw. Exceptional Handling:-
  • 8. Try – detects the part of the code where we are looking for exceptions, Catch – is used to determine the type of exceptions and how the caught exceptions will be handled throw – it can be called from anywhere in the program code in a try ... If an error is thrown and not caught in a try ... catch block it will cause an abrupt termination of the program
  • 9. 1. Writing a simple try-catch