✏️ Explanatory Question

What is the role of
(i) throws keyword?
(ii) throw keyword?

👁 19 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

(i) throws keyword?

Answer: Declares exceptions that a method may pass to the calling method.

(ii) throw keyword?

Answer: Used to explicitly throw an exception.