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 comparison table
Subject have syntax have example have purpose is a subtopic of is a synonym of is a kind of have part
decision making statement  to make a decision on which branch of code to follow in a programLoops and Decision Makingconditional statementcontrol flow statement 
exception statement  to handle exceptionsException Handling control flow statement 
try-catch-finally statement
try{
statements
} catch (exception_type1 identifier1) {
statements
} catch (exception_type2 identifier2) {
statements
...
} finally {
statements
}
//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;
}
to handle exceptionsException Handling exception statementtry block, catch block(s), finally block

Next decision making statementif statement    Updecision making statement, exception statement    Previous decision making statementswitch-case statement