What is wrong with this fragment?
Single Choice
Views 32
Answer:
// • • • vals[18] = 10; catch (ArrayIndexOutOfBoundsException exc) { // handle error }
Solution:
The error is that there is no try block before the catch statement.
A catch block must follow a try block, otherwise the compiler will throw an error.
The corrected code should be:
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.