+ 2
What is the difference between Throw and Throws in Java Exception Handling?
2 ответов
+ 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 :)
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.