Base of Difference | throws keyword | throw keyword |
Basic definition | We mainly used throws keyword in method signature to declare an exception which may be thrown by function when we execute the code. | On the other hand throw keyword is mainly used to throw and exception explicitly in program inside a function or inside a block of code. |
Propagated with | Here checked exception can be propagated with throws. | Here checked exception can be propagated with throws. |
Followed by | Here throws keyword is mainly followed by class. | Here throw keyword is mainly followed by an instance. |
Used in | Throws keyword is mainly used with the method signature. | throw keyword is mainly used within the method. |
Multiple exceptions | Here we can declare multiple exceptions for example public void method()throws IOException, SQLException.
| Here we cannot throw multiple exceptions
|