Intermediate
Java
Q56 / 100
What is the difference between throw and throws?
Correct! Well done.
Incorrect.
The correct answer is B) throw is used to actually throw an exception; throws declares that a method may throw an exception
B
Correct Answer
throw is used to actually throw an exception; throws declares that a method may throw an exception
Explanation
throw new SomeException() is the statement that raises an exception. throws in a method signature tells callers which checked exceptions the method may propagate.
Progress
56/100