+ 2

What is the difference between Throw and Throws in Java Exception Handling?

24th Aug 2016, 5:31 PM
Agha Asad Khan
Agha Asad Khan - avatar
2 Answers
+ 1
throw is used to handle a single exception for eg ArithmeticException or NullPointerException while throws is used to handle multiple exceptions in a block that is y 's' is used in throws as it stands for multiple throws :)
24th Aug 2016, 5:41 PM
shivanidalmia
shivanidalmia - avatar
0
The throw keyword introduces an instance of a Throwable exception into the stack, while throws is used in a method declaration to indicate that it may throw an uncaught checked exception.
25th Aug 2016, 1:35 AM
Benjamin Sullivan
Benjamin Sullivan - avatar