Articles → Java → Throw Vs Throws In Java
Throw Vs Throws In Java
Throw | Throws |
---|
Throw keyword is used to explicitly throw an exception | Throws keyword is used to declare an exception in the method. |
Throw keyword is used within the method | Throws keyword is used in method signature |
You cannot throw multiple exceptions in one method. | You can declare multiple exceptions using throws keyword. |
Syntax wise, throw is followed by new keyword. | Throws is followed by exception class name. |