try
The try block contains code that might throw an exception. It is used to wrap code that could potentially lead to an error during runtime.
catch
The catch block follows the try block and is used to handle exceptions thrown by the code inside the try block. You can have multiple catch blocks to handle different types of exceptions.
finally
The finally block follows the try and catch blocks and contains code that will always execute, regardless of whether an exception was thrown or caught. It is typically used for cleanup activities, such as closing resources.
throw
The throw keyword is used to explicitly throw an exception. This can be a custom exception or a predefined one.
throws
The throws keyword is used in a method signature to declare that the method might throw one or more exceptions. This tells the caller of the method to handle or propagate the exceptions.