Suppose, for example, that you want to open a file for reading using a
FileInputStream
instance. You can acknowledge that the attempt
may throw an exception by embedding the reading expressions in a block
following the try
keyword.
Java stops executing statements in the try
block as soon as an
exception is thrown:
try { ... <-- An attempt to attach a stream to a file occurs here }