Which exception type must be explicitly handled or declared to be thrown in a method?
- Checked exceptions
- Errors
- None of the above
- Unchecked exceptions (Runtime)
In Java, checked exceptions (which extend the Exception class but not RuntimeException) must be explicitly handled or declared to be thrown in a method. This requirement ensures that the code handles potentially problematic situations.
Loading...
Related Quiz
- When an array element, such as arr[2][3], is accessed, Java uses ________ to locate it in memory.
- What is the worst-case time complexity of Linear Search?
- Which exception might be thrown when opening a file for reading?
- The @FunctionalInterface annotation is used to indicate that an interface is to be used with ________.
- How can a developer prevent a field from being serialized?