Developer community
0 votes
919 views
asked by Advisor (8.4k points) 10 15 18 | 919 views

1 Answer

0 votes
 
To handle an exception we put code which might have exceptions in a try...catch statement.
 
try { 
// block of code to monitor for errors 
catch (ExceptionType1 exOb) { 
// exception handler for ExceptionType1 
}
catch (ExceptionType2 exOb) { 
// exception handler for ExceptionType2 
}
 
Program statements that might have exceptions are contained within a try block. The exception handler is coded using catch statement
 
Here, ExceptionType is the type of exception that has occurred.
 
answered by Sr Member (5k points) 7 10 12

Related questions

0 votes
1 answer
asked by omari Sr Member (3.9k points) 5 8 12 | 1.4k views
0 votes
2 answers
asked by omari Sr Member (3.9k points) 5 8 12 | 1.5k views
0 votes
1 answer
asked by arnav Sr Member (1.3k points) 9 21 28 | 64 views
0 votes
2 answers
asked by john Guru (27.1k points) 35 53 114 | 13 views
0 votes
1 answer
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,754 questions
4,046 answers
117 comments
10,709 users