Definition of Throws keyword:

It is a key word using which the end-user is informed that a particular function is proven to transfer exception class objects to its calling place. Most of us will be in the wrong perception that using throws keyword we can handle exception. But it is not true. Whether we use throws key word or not, the exception class object generated in a function will definitely reach the calling place.

Uses of throws keyword:

  1. By seeing the throws keyword along with the function definition, we can understand that, the function has statements which are prove to generate the mentioned exception class objects and they are not handled is the function itself.
  2. If we want to skip the try block inside the function, even though if it is generating checked options, then simply place throws keyword along with the type of exception generated. But condition is, the function call should be made inside a try block at the calling place.
  3. When ever try block has n number of blocks , then if an exception object is created, the order of preference of catch blocks is , the order in which they are present below the try block.