SlideShare a Scribd company logo
Submitted to :-
Mr.r.s.s.rawat
(H.O.D. of it department)
Submitted by:-
Satish ahirwar
B.e. VIIth sem
enroll no.:-0601it131046
Contents
What is an Exception .
What happen when an Exception is occurs.
Runtime Error.
Exception class Hierarchy.
Types of Exception.
Exception Handling Keywords.
Methods for printing the details of an
Exception.
What is an Exception?
In general, Exception are run time errors caused
due to logical mistakes occurred during program
execution because of its wroung input.
Examples:-
ArithmaticException.
ArrayOutOfBoundException.
IOException.
FileNotFoundException.
SQLException.
etc.
Exception Example
(ArithmeticException)
1 class DivByZero {
2
3
public static void main(String args[]) {
System.out.println(3/0);
4 System.out.println(“Pls. print me.”);
5 }
6 }
What Happens When an Exception
Occurs?
When an exception occurs within a method, the
method creates an exception object and hands it off
to the runtime system.
Exception object contains information about the error,
including its type and the state of the program when the
error occurred.
Example: Default Exception Handling
 Displays this error message
Exception in thread "main"
java.lang.ArithmeticException: / by zero
at DivByZero.main(DivByZero.java:3)
 Default exception handler
–
–
–
Provided by Java runtime
Prints out exception description
Prints the stack trace
Runtime Error
It is also unwanted unexpected problem .
A run time error is occurs due to the system
resource problem for run time error it is not
possible to provide the solution
programmatically.
Examples:-
StackOverFlowError
OutOfMemoryError
Etc.
Exception class Hierarchy
Types Of Exception
In java there are two types of exception .
 Checked Exception-the checked Exceptions
are recognised by compiler.
 Unchecked Exception.- The Unchecked
Exceptions are not recognised by comiler.
Checked Exception
Unchecked Exception
ERROR
OutOfMemoryError
StackOverFlowError
etc,.
Exception Handling Keywords
try
catch
finally
throws
throw
syntax
try
{ // Risky Code
}
catch(type of exception-1 object-1)
{ // Handling Code
}
catch(type of exception-2 object-2)
{ // Handling Code
}
finally
{ // Resource releasing logic.
}
throw Keyword
●
●
Java allows you to throw exceptions (generate
exceptions)
throw <exception object>;
An exception you throw is an object
–
●
You have to create an exception object in the same way
you create any other object
Example:
throw new ArithmeticException(“testing...”);
throws Keyword
●
Throws is a java Keyword use to by paas
generated exception from present method to
calling methods.
Syntax
Methodname() throws <Exceptionobject>
{
//throw Exception object
}
Methods for printing the details
of an Exception.
In java there are three methods for Printing the details of an Exception
• Public void PrintstackTrace()
{name of the Exception: Discription of the Exception:Location of the Exception}
• Public String toString ()
{Name of the Exception :Discription of the Exception.}
• Public String getmessage()
{Discription of the Exception}
60
Thank You!

More Related Content

What's hot

Exception handling
Exception handling Exception handling
Exception handling
M Vishnuvardhan Reddy
 
Exception Handling in Java
Exception Handling in JavaException Handling in Java
Exception Handling in Java
lalithambiga kamaraj
 
Exception handling in java
Exception handling in java Exception handling in java
Exception handling in java
yugandhar vadlamudi
 
Java exception
Java exception Java exception
Java exception
Arati Gadgil
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
Lovely Professional University
 
Java exception handling
Java exception handlingJava exception handling
Java exception handlingBHUVIJAYAVELU
 
Exception Handling in JAVA
Exception Handling in JAVAException Handling in JAVA
Exception Handling in JAVA
SURIT DATTA
 
Exceptionhandling
ExceptionhandlingExceptionhandling
Exceptionhandling
Nuha Noor
 
7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handlingDeepak Sharma
 
Java - Exception Handling
Java - Exception HandlingJava - Exception Handling
Java - Exception HandlingPrabhdeep Singh
 
Exception handling in java
Exception handling  in javaException handling  in java
Exception handling in java
Elizabeth alexander
 
Java: Exception
Java: ExceptionJava: Exception
Java: Exception
Tareq Hasan
 
Exception Handling Java
Exception Handling JavaException Handling Java
Exception Handling Java
ankitgarg_er
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
ARAFAT ISLAM
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
pooja kumari
 
Exception Handling
Exception HandlingException Handling
Exception Handling
Reddhi Basu
 
Exceptions in Java
Exceptions in JavaExceptions in Java
Exceptions in JavaVadym Lotar
 
Exceptions in java
Exceptions in javaExceptions in java
Exceptions in java
Sameer Patil
 

What's hot (20)

Exception handling
Exception handling Exception handling
Exception handling
 
Exception Handling in Java
Exception Handling in JavaException Handling in Java
Exception Handling in Java
 
Exception handling in java
Exception handling in java Exception handling in java
Exception handling in java
 
Java exception
Java exception Java exception
Java exception
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
Exception Handling in JAVA
Exception Handling in JAVAException Handling in JAVA
Exception Handling in JAVA
 
Exceptionhandling
ExceptionhandlingExceptionhandling
Exceptionhandling
 
7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handling
 
Java - Exception Handling
Java - Exception HandlingJava - Exception Handling
Java - Exception Handling
 
Exception handling in java
Exception handling  in javaException handling  in java
Exception handling in java
 
Java: Exception
Java: ExceptionJava: Exception
Java: Exception
 
Exception Handling Java
Exception Handling JavaException Handling Java
Exception Handling Java
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Exceptions in Java
Exceptions in JavaExceptions in Java
Exceptions in Java
 
Exceptions in java
Exceptions in javaExceptions in java
Exceptions in java
 

Viewers also liked

Constructors
ConstructorsConstructors
Constructors
Puneet tiwari
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Appletbackdoor
 
Basics of applets.53
Basics of applets.53Basics of applets.53
Basics of applets.53myrajendra
 
Srgoc java
Srgoc javaSrgoc java
Srgoc java
Gaurav Singh
 
L5 classes, objects, nested and inner class
L5 classes, objects, nested and inner classL5 classes, objects, nested and inner class
L5 classes, objects, nested and inner class
teach4uin
 
Applets in java
Applets in javaApplets in java
Applets in java
Wani Zahoor
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
mcanotes
 
Static keyword ppt
Static keyword pptStatic keyword ppt
Static keyword ppt
Vinod Kumar
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
Abdul Rahman Sherzad
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
amitksaha
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cyclemyrajendra
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for selenium
apoorvams
 
Applet progming
Applet progmingApplet progming
Applet progming
VIKRANTHMALLIKARJUN
 
Latest Development in the field of IT(Information Technology)
Latest Development in the field of IT(Information Technology)Latest Development in the field of IT(Information Technology)
Latest Development in the field of IT(Information Technology)
Muhammad Jasim
 
Latest trends in information technology
Latest trends in information technologyLatest trends in information technology
Latest trends in information technology
Eldos Kuriakose
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
Volker Hirsch
 

Viewers also liked (16)

Constructors
ConstructorsConstructors
Constructors
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
 
Basics of applets.53
Basics of applets.53Basics of applets.53
Basics of applets.53
 
Srgoc java
Srgoc javaSrgoc java
Srgoc java
 
L5 classes, objects, nested and inner class
L5 classes, objects, nested and inner classL5 classes, objects, nested and inner class
L5 classes, objects, nested and inner class
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
 
Static keyword ppt
Static keyword pptStatic keyword ppt
Static keyword ppt
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for selenium
 
Applet progming
Applet progmingApplet progming
Applet progming
 
Latest Development in the field of IT(Information Technology)
Latest Development in the field of IT(Information Technology)Latest Development in the field of IT(Information Technology)
Latest Development in the field of IT(Information Technology)
 
Latest trends in information technology
Latest trends in information technologyLatest trends in information technology
Latest trends in information technology
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
 

Similar to Satish training ppt

Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024
kashyapneha2809
 
Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024
nehakumari0xf
 
Exception handling
Exception handlingException handling
Exception handling
Karthik Sekar
 
Interface andexceptions
Interface andexceptionsInterface andexceptions
Interface andexceptions
saman Iftikhar
 
unit 4 msbte syallbus for sem 4 2024-2025
unit 4 msbte syallbus for sem 4 2024-2025unit 4 msbte syallbus for sem 4 2024-2025
unit 4 msbte syallbus for sem 4 2024-2025
AKSHAYBHABAD5
 
Exception Handling.pptx
Exception Handling.pptxException Handling.pptx
Exception Handling.pptx
primevideos176
 
Exceptions overview
Exceptions overviewExceptions overview
Exceptions overview
Bharath K
 
Class notes(week 8) on exception handling
Class notes(week 8) on exception handlingClass notes(week 8) on exception handling
Class notes(week 8) on exception handling
Kuntal Bhowmick
 
Exception handling
Exception handlingException handling
Exception handling
Raja Sekhar
 
Z blue exception
Z blue   exceptionZ blue   exception
Z blue exception
Narayana Swamy
 
Exceptions handling in java
Exceptions handling in javaExceptions handling in java
Exceptions handling in java
junnubabu
 
Session 12 - Exception Handling - Part 1
Session 12 - Exception Handling - Part 1Session 12 - Exception Handling - Part 1
Session 12 - Exception Handling - Part 1
PawanMM
 
12. Java Exceptions and error handling
12. Java Exceptions and error handling12. Java Exceptions and error handling
12. Java Exceptions and error handling
Intro C# Book
 
Java -Exception handlingunit-iv
Java -Exception handlingunit-ivJava -Exception handlingunit-iv
Java -Exception handlingunit-iv
RubaNagarajan
 
Exception Handling.pdf
Exception Handling.pdfException Handling.pdf
Exception Handling.pdf
lsdfjldskjf
 
Exception Handling - Part 1
Exception Handling - Part 1 Exception Handling - Part 1
Exception Handling - Part 1
Hitesh-Java
 
Exceptions in java
Exceptions in javaExceptions in java
Exceptions in java
JasmeetSingh326
 
Ch-1_5.pdf this is java tutorials for all
Ch-1_5.pdf this is java tutorials for allCh-1_5.pdf this is java tutorials for all
Ch-1_5.pdf this is java tutorials for all
HayomeTakele
 

Similar to Satish training ppt (20)

Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024
 
Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024
 
java exception.pptx
java exception.pptxjava exception.pptx
java exception.pptx
 
Exception handling
Exception handlingException handling
Exception handling
 
Interface andexceptions
Interface andexceptionsInterface andexceptions
Interface andexceptions
 
unit 4 msbte syallbus for sem 4 2024-2025
unit 4 msbte syallbus for sem 4 2024-2025unit 4 msbte syallbus for sem 4 2024-2025
unit 4 msbte syallbus for sem 4 2024-2025
 
UNIT 2.pptx
UNIT 2.pptxUNIT 2.pptx
UNIT 2.pptx
 
Exception Handling.pptx
Exception Handling.pptxException Handling.pptx
Exception Handling.pptx
 
Exceptions overview
Exceptions overviewExceptions overview
Exceptions overview
 
Class notes(week 8) on exception handling
Class notes(week 8) on exception handlingClass notes(week 8) on exception handling
Class notes(week 8) on exception handling
 
Exception handling
Exception handlingException handling
Exception handling
 
Z blue exception
Z blue   exceptionZ blue   exception
Z blue exception
 
Exceptions handling in java
Exceptions handling in javaExceptions handling in java
Exceptions handling in java
 
Session 12 - Exception Handling - Part 1
Session 12 - Exception Handling - Part 1Session 12 - Exception Handling - Part 1
Session 12 - Exception Handling - Part 1
 
12. Java Exceptions and error handling
12. Java Exceptions and error handling12. Java Exceptions and error handling
12. Java Exceptions and error handling
 
Java -Exception handlingunit-iv
Java -Exception handlingunit-ivJava -Exception handlingunit-iv
Java -Exception handlingunit-iv
 
Exception Handling.pdf
Exception Handling.pdfException Handling.pdf
Exception Handling.pdf
 
Exception Handling - Part 1
Exception Handling - Part 1 Exception Handling - Part 1
Exception Handling - Part 1
 
Exceptions in java
Exceptions in javaExceptions in java
Exceptions in java
 
Ch-1_5.pdf this is java tutorials for all
Ch-1_5.pdf this is java tutorials for allCh-1_5.pdf this is java tutorials for all
Ch-1_5.pdf this is java tutorials for all
 

Recently uploaded

Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 

Recently uploaded (20)

Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 

Satish training ppt

  • 1. Submitted to :- Mr.r.s.s.rawat (H.O.D. of it department) Submitted by:- Satish ahirwar B.e. VIIth sem enroll no.:-0601it131046
  • 2.
  • 3. Contents What is an Exception . What happen when an Exception is occurs. Runtime Error. Exception class Hierarchy. Types of Exception. Exception Handling Keywords. Methods for printing the details of an Exception.
  • 4. What is an Exception? In general, Exception are run time errors caused due to logical mistakes occurred during program execution because of its wroung input. Examples:- ArithmaticException. ArrayOutOfBoundException. IOException. FileNotFoundException. SQLException. etc.
  • 5. Exception Example (ArithmeticException) 1 class DivByZero { 2 3 public static void main(String args[]) { System.out.println(3/0); 4 System.out.println(“Pls. print me.”); 5 } 6 }
  • 6. What Happens When an Exception Occurs? When an exception occurs within a method, the method creates an exception object and hands it off to the runtime system. Exception object contains information about the error, including its type and the state of the program when the error occurred.
  • 7. Example: Default Exception Handling  Displays this error message Exception in thread "main" java.lang.ArithmeticException: / by zero at DivByZero.main(DivByZero.java:3)  Default exception handler – – – Provided by Java runtime Prints out exception description Prints the stack trace
  • 8. Runtime Error It is also unwanted unexpected problem . A run time error is occurs due to the system resource problem for run time error it is not possible to provide the solution programmatically. Examples:- StackOverFlowError OutOfMemoryError Etc.
  • 10. Types Of Exception In java there are two types of exception .  Checked Exception-the checked Exceptions are recognised by compiler.  Unchecked Exception.- The Unchecked Exceptions are not recognised by comiler.
  • 14. syntax try { // Risky Code } catch(type of exception-1 object-1) { // Handling Code } catch(type of exception-2 object-2) { // Handling Code } finally { // Resource releasing logic. }
  • 15. throw Keyword ● ● Java allows you to throw exceptions (generate exceptions) throw <exception object>; An exception you throw is an object – ● You have to create an exception object in the same way you create any other object Example: throw new ArithmeticException(“testing...”);
  • 16. throws Keyword ● Throws is a java Keyword use to by paas generated exception from present method to calling methods. Syntax Methodname() throws <Exceptionobject> { //throw Exception object }
  • 17. Methods for printing the details of an Exception. In java there are three methods for Printing the details of an Exception • Public void PrintstackTrace() {name of the Exception: Discription of the Exception:Location of the Exception} • Public String toString () {Name of the Exception :Discription of the Exception.} • Public String getmessage() {Discription of the Exception}
  • 18.
  • 19.