What is the role of (i) throws keyword ? (ii) throw keyword ?
Long Answer
Views 23
Answer:
| 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 |
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.