|
1. Choose two problems from 10.2 - 10.7.
10.2) What is a try block?
A try block is a
block of code between braces {}, that helps handle exceptions. When
an exception is handled within a try block, the program passes control to
the appropriate handler to deal with the exception. The catch blocks
are the handlers in this case and will attempt to resolve the exception
within the block of code following the try block.
10.5) What is a runtime
exception?
A runtime exception is
one that a program encounters when erroneous data is input or calculated.
Some examples are arithmetic errors, missing files, this includes
misspelled file names, and format errors. Runtime errors can either
be thrown by the program using the throws command or caught
using a try-catch block.
Send me email
Visit my website
|