Java   View all facts   Glossary   Help
syntactic unit > statement > control flow statement > decision making statement > try-catch-finally statement
Next decision making statementif statement    Updecision making statement, exception statement    Previous decision making statementswitch-case statement   

try-catch-finally statement
subjectfact 
try-catch-finally statementhas example
//Any division by zero that occurs when executing the try block will result in execution of the catch block. 
//Once either block completes, execution continues at the statement after the catch block.
try
{
result = numerator / denominator;
validResult = true;
}
catch (ArithmeticException e)
{
validResult = false;
}
  
source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:38:09.0
has part try block, catch block(s), finally blockadded by: JK, 2001-10-19 11:38:09.0
has syntax
try{
statements
} catch (exception_type1 identifier1) {
statements
} catch (exception_type2 identifier2) {
statements
...
} finally {
statements
}
added by: JK, 2001-10-19 11:38:09.0
is a subtopic of Exception Handling2001-10-19 11:38:10.0
is a subtopic of Exception Handling2001-10-19 11:38:10.0
is a kind of decision making statementsource: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:38:10.0
is a kind of exception statementadded by: JK, source: Sun Java Tutorial, 2001-10-19 11:38:10.0
decision making statementhas purpose to make a decision on which branch of code to follow in a program2001-10-19 11:36:35.0
exception statementhas purpose to handle exceptions2001-10-19 11:36:41.0
statementis terminated by a semicolon    2001-10-19 11:37:57.0
should be not more than one line long if possible2001-10-19 11:37:57.0
syntactic unithas syntax rule
bold = mandatory
italic = non-terminal
normal font = optional
2001-10-19 11:38:04.0