✏️ Explanatory Question

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

👁 31 Views
📘 Detailed Answer
🔴 Hard
31
Total Views
10
Related Qs
0%
Progress
💡

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