SlideShare a Scribd company logo
Errors 
Compile time errors: These are syntactical errors found in 
the code, due to which a program fails to compile. E.g. 
missing semicolon at the end of statement, a statement 
without proper syntax etc. 
Run time errors: These errors represent inefficiency of the 
computer system to execute a particular statement. E.g. 
insufficient memory to store something or inability of the 
microprocessor to execute some statement come under 
run-time error. 
public static void main( )
Errors… 
Logical errors: These errors depict flaws in the logic of the 
program. The programmer might be using a wrong 
formula or the design of the program itself is wrong. 
Logical errors are not detected either by java compiler or 
JVM. 
Exceptions 
Checked: The exceptions that are checked at compilation 
time are called ‘Checked Exception’. 
Unchecked: The Exceptions that are checked by JVM are 
called ‘Unchecked Exceptions’.
Exceptions… 
Unchecked exceptions are considered as unrecoverable 
and the programmer cannot do any thing when they 
occur. Programmer can write a java program with 
unchecked exceptions, he can see their effect only when 
he runs the program. 
In case of checked exception, a programmer should either 
handle them or throw them without handling them. He 
cannot simply ignore the checked exception. 
public static void main(String args[]) throws IOException
Exceptions… 
class Test 
{ 
public static void main(String args[]) 
{ 
int n = args.length; 
int a = 45 / n; 
System.out.println(“The value of a is :”+a); 
} 
}
Exceptions Handling 
When there is an exception, the user data may be 
corrupted. To handle the exception, programmer should 
perform 3 steps: 
1. try{ 
Statements; 
} 
2. catch(Exceptionclass ref) { 
statements; 
} 
3. finally{ 
statements; 
}
Exception Handling… 
class Test 
{ 
public static void main(String args[]) 
{ 
try { 
int n = args.length; 
int a = 45 / n; 
System.out.println(“The value of a is :”+a); } 
catch(ArithmeticException ae) { 
System.out.println(ae); 
System.out.println(“Arguments are required”); } 
finally { 
System.out.println(“End of program”); } 
} 
}
Handling Multiple Exception 
class Test { 
public static void main(String args[]) { 
try { 
int n = args.length; 
int a = 45 / n; 
System.out.println(“The value of a is :”+a); 
int b[] = {10,20,30}; 
b[5] = 100; } 
catch(ArithmeticException ae) { 
System.out.println(ae); 
System.out.println(“Arguments are required”); } 
catch(ArrayIndexOutOfBoundsException aie) { 
aie.printStackTrace(); 
System.out.println(“Array index out of range”); } 
finally { 
System.out.println(“End of program”); } 
} }

More Related Content

What's hot

Exception handling in c++ by manoj vasava
Exception handling in c++ by manoj vasavaException handling in c++ by manoj vasava
Exception handling in c++ by manoj vasava
Manoj_vasava
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
ravinderkaur165
 
Exception Handling Java
Exception Handling JavaException Handling Java
Exception Handling Java
ankitgarg_er
 
Exception handling
Exception handlingException handling
Exception handling
Harry Potter
 
Exception handling
Exception handlingException handling
Exception handling
Abhishek Pachisia
 
14 exception handling
14 exception handling14 exception handling
14 exception handlingjigeno
 
Exception Handling In Java 15734
Exception Handling In Java 15734Exception Handling In Java 15734
Exception Handling In Java 15734
madhurendra pandey
 
Compiler design error handling
Compiler design error handlingCompiler design error handling
Compiler design error handling
RohitK71
 
Programming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStringsProgramming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStrings
Alan Richardson
 
Exception handling in JAVA
Exception handling in JAVAException handling in JAVA
Exception handling in JAVA
Kunal Singh
 
Exception handling in c
Exception handling in cException handling in c
Exception handling in cMemo Yekem
 
Exception handler
Exception handler Exception handler
Exception handler dishni
 
Exception handling in c programming
Exception handling in c programmingException handling in c programming
Exception handling in c programming
Raza Najam
 
Presentation1
Presentation1Presentation1
Presentation1
Anul Chaudhary
 

What's hot (14)

Exception handling in c++ by manoj vasava
Exception handling in c++ by manoj vasavaException handling in c++ by manoj vasava
Exception handling in c++ by manoj vasava
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Exception Handling Java
Exception Handling JavaException Handling Java
Exception Handling Java
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception handling
Exception handlingException handling
Exception handling
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
 
Exception Handling In Java 15734
Exception Handling In Java 15734Exception Handling In Java 15734
Exception Handling In Java 15734
 
Compiler design error handling
Compiler design error handlingCompiler design error handling
Compiler design error handling
 
Programming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStringsProgramming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStrings
 
Exception handling in JAVA
Exception handling in JAVAException handling in JAVA
Exception handling in JAVA
 
Exception handling in c
Exception handling in cException handling in c
Exception handling in c
 
Exception handler
Exception handler Exception handler
Exception handler
 
Exception handling in c programming
Exception handling in c programmingException handling in c programming
Exception handling in c programming
 
Presentation1
Presentation1Presentation1
Presentation1
 

Viewers also liked

Handling inputs via io..continue
Handling inputs via io..continueHandling inputs via io..continue
Handling inputs via io..continue
simarsimmygrewal
 
Geometrical tolerance 2014
Geometrical tolerance 2014Geometrical tolerance 2014
Geometrical tolerance 2014
Ashutosh Bhalerao
 
Media Storyboard
Media StoryboardMedia Storyboard
Media Storyboard
Cloee Lang
 
Approaches_for_planning_the_ISS_cosmonau
Approaches_for_planning_the_ISS_cosmonauApproaches_for_planning_the_ISS_cosmonau
Approaches_for_planning_the_ISS_cosmonauNail Khusnullin
 
Dracula
DraculaDracula
tes
testes
Photoshop project tutorial
Photoshop project tutorialPhotoshop project tutorial
Photoshop project tutorial
meyrni-ahmed
 
Análisis numérico - Cálculo numérico y manejo de errores
Análisis numérico - Cálculo numérico y manejo de erroresAnálisis numérico - Cálculo numérico y manejo de errores
Análisis numérico - Cálculo numérico y manejo de errores
danielhp24
 
Engaging Service through Action
Engaging Service through ActionEngaging Service through Action
Engaging Service through Action
Pavan Purswani
 

Viewers also liked (11)

Handling inputs via io..continue
Handling inputs via io..continueHandling inputs via io..continue
Handling inputs via io..continue
 
Geometrical tolerance 2014
Geometrical tolerance 2014Geometrical tolerance 2014
Geometrical tolerance 2014
 
Media Storyboard
Media StoryboardMedia Storyboard
Media Storyboard
 
Java file
Java fileJava file
Java file
 
Approaches_for_planning_the_ISS_cosmonau
Approaches_for_planning_the_ISS_cosmonauApproaches_for_planning_the_ISS_cosmonau
Approaches_for_planning_the_ISS_cosmonau
 
Dracula
DraculaDracula
Dracula
 
tes
testes
tes
 
Photoshop project tutorial
Photoshop project tutorialPhotoshop project tutorial
Photoshop project tutorial
 
Repositorio digital
Repositorio digitalRepositorio digital
Repositorio digital
 
Análisis numérico - Cálculo numérico y manejo de errores
Análisis numérico - Cálculo numérico y manejo de erroresAnálisis numérico - Cálculo numérico y manejo de errores
Análisis numérico - Cálculo numérico y manejo de errores
 
Engaging Service through Action
Engaging Service through ActionEngaging Service through Action
Engaging Service through Action
 

Similar to Excception handling

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
 
Java exception handling
Java exception handlingJava exception handling
Java exception handlingBHUVIJAYAVELU
 
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
 
UNIT-3.pptx Exception Handling and Multithreading
UNIT-3.pptx Exception Handling and MultithreadingUNIT-3.pptx Exception Handling and Multithreading
UNIT-3.pptx Exception Handling and Multithreading
SakkaravarthiS1
 
Exception handling
Exception handlingException handling
Exception handling
Ardhendu Nandi
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
ARAFAT ISLAM
 
Exception handling
Exception handlingException handling
Exception handling
Raja Sekhar
 
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
 
Itp 120 Chapt 18 2009 Exceptions & Assertions
Itp 120 Chapt 18 2009 Exceptions & AssertionsItp 120 Chapt 18 2009 Exceptions & Assertions
Itp 120 Chapt 18 2009 Exceptions & Assertionsphanleson
 
Exception handling
Exception handlingException handling
Exception handling
Karthik Sekar
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
AmbigaMurugesan
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
gopalrajput11
 
Z blue exception
Z blue   exceptionZ blue   exception
Z blue exception
Narayana Swamy
 
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
 
7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handlingDeepak Sharma
 
exceptionvdffhhhccvvvv-handling-in-java.ppt
exceptionvdffhhhccvvvv-handling-in-java.pptexceptionvdffhhhccvvvv-handling-in-java.ppt
exceptionvdffhhhccvvvv-handling-in-java.ppt
yjrtytyuu
 
Java -Exception handlingunit-iv
Java -Exception handlingunit-ivJava -Exception handlingunit-iv
Java -Exception handlingunit-iv
RubaNagarajan
 

Similar to Excception handling (20)

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
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
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
 
UNIT-3.pptx Exception Handling and Multithreading
UNIT-3.pptx Exception Handling and MultithreadingUNIT-3.pptx Exception Handling and Multithreading
UNIT-3.pptx Exception Handling and Multithreading
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Exception handling
Exception handlingException handling
Exception handling
 
UNIT 2.pptx
UNIT 2.pptxUNIT 2.pptx
UNIT 2.pptx
 
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
 
Itp 120 Chapt 18 2009 Exceptions & Assertions
Itp 120 Chapt 18 2009 Exceptions & AssertionsItp 120 Chapt 18 2009 Exceptions & Assertions
Itp 120 Chapt 18 2009 Exceptions & Assertions
 
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
 
Z blue exception
Z blue   exceptionZ blue   exception
Z blue exception
 
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
 
7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handling
 
exceptionvdffhhhccvvvv-handling-in-java.ppt
exceptionvdffhhhccvvvv-handling-in-java.pptexceptionvdffhhhccvvvv-handling-in-java.ppt
exceptionvdffhhhccvvvv-handling-in-java.ppt
 
Java -Exception handlingunit-iv
Java -Exception handlingunit-ivJava -Exception handlingunit-iv
Java -Exception handlingunit-iv
 

More from simarsimmygrewal

C file
C fileC file
Java file
Java fileJava file
Java file
simarsimmygrewal
 
C file
C fileC file
C++ file
C++ fileC++ file
Handling inputs via scanner class
Handling inputs via scanner classHandling inputs via scanner class
Handling inputs via scanner class
simarsimmygrewal
 
Type casting
Type castingType casting
Type casting
simarsimmygrewal
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
simarsimmygrewal
 

More from simarsimmygrewal (7)

C file
C fileC file
C file
 
Java file
Java fileJava file
Java file
 
C file
C fileC file
C file
 
C++ file
C++ fileC++ file
C++ file
 
Handling inputs via scanner class
Handling inputs via scanner classHandling inputs via scanner class
Handling inputs via scanner class
 
Type casting
Type castingType casting
Type casting
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 

Excception handling

  • 1. Errors Compile time errors: These are syntactical errors found in the code, due to which a program fails to compile. E.g. missing semicolon at the end of statement, a statement without proper syntax etc. Run time errors: These errors represent inefficiency of the computer system to execute a particular statement. E.g. insufficient memory to store something or inability of the microprocessor to execute some statement come under run-time error. public static void main( )
  • 2. Errors… Logical errors: These errors depict flaws in the logic of the program. The programmer might be using a wrong formula or the design of the program itself is wrong. Logical errors are not detected either by java compiler or JVM. Exceptions Checked: The exceptions that are checked at compilation time are called ‘Checked Exception’. Unchecked: The Exceptions that are checked by JVM are called ‘Unchecked Exceptions’.
  • 3. Exceptions… Unchecked exceptions are considered as unrecoverable and the programmer cannot do any thing when they occur. Programmer can write a java program with unchecked exceptions, he can see their effect only when he runs the program. In case of checked exception, a programmer should either handle them or throw them without handling them. He cannot simply ignore the checked exception. public static void main(String args[]) throws IOException
  • 4. Exceptions… class Test { public static void main(String args[]) { int n = args.length; int a = 45 / n; System.out.println(“The value of a is :”+a); } }
  • 5. Exceptions Handling When there is an exception, the user data may be corrupted. To handle the exception, programmer should perform 3 steps: 1. try{ Statements; } 2. catch(Exceptionclass ref) { statements; } 3. finally{ statements; }
  • 6. Exception Handling… class Test { public static void main(String args[]) { try { int n = args.length; int a = 45 / n; System.out.println(“The value of a is :”+a); } catch(ArithmeticException ae) { System.out.println(ae); System.out.println(“Arguments are required”); } finally { System.out.println(“End of program”); } } }
  • 7. Handling Multiple Exception class Test { public static void main(String args[]) { try { int n = args.length; int a = 45 / n; System.out.println(“The value of a is :”+a); int b[] = {10,20,30}; b[5] = 100; } catch(ArithmeticException ae) { System.out.println(ae); System.out.println(“Arguments are required”); } catch(ArrayIndexOutOfBoundsException aie) { aie.printStackTrace(); System.out.println(“Array index out of range”); } finally { System.out.println(“End of program”); } } }