✏️ Explanatory Question

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

👁 35 Views
📘 Detailed Answer
🔴 Hard
💡

Answer with Explanation

Keyword Purpose
throw Used to manually throw an exception. Example: throw new IOException("Error!");
throws Declares that a method might throw an exception. Example: void readFile() throws IOException