When you have to specifically indicate that a particular method or function might have to throw mentioned exceptions, you use the throws keyword after the definition of your function. If somebody is calling such a function, that person will have to handle the specified exceptions using the try and catch blocks. If you're looking to learn java, below is the proper syntax for the same:
1 2 3 4 | return_type method_name(parameter_list) throws exception_list { //your code } |