← Quiz: Java Exception Handling: all 10 questions
Quiz: Java Exception Handling · Question 3 of 10
What is the difference between throw and throws?
What is the difference between throw and throws?
- A.They are the same
- B.throw throws an exception object; throws declares exceptions in a method signature
- C.throws throws an object; throw declares
- D.throw is only for errors
Answer & explanation
Correct answer: throw throws an exception object; throws declares exceptions in a method signature
throw new X(...) inside code; void m() throws X in the signature.
Can you get the rest right without peeking?
Take the timed Quiz: Java Exception Handling quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →