handle exceptions, the code that throws exceptions is placed inside a try block, and the code that handles the exceptions is placed inside a catch block, and the code that needs to be executed regardless of whether or not an exception is thrown is placed inside the finally block.