When creating a custom exception, extending which class will make it a checked exception?
- Error
- Exception
- RuntimeException
- Throwable
When you extend the Exception class (or its subclasses), your custom exception becomes a checked exception in Java. Checked exceptions must be either caught or declared in the method signature where they are thrown.
Loading...
Related Quiz
- What is the role of a URLConnection object in the context of network programming in Java?
- Can we overload a method in the same class where it is already defined?
- What is the difference between a synchronized block and a synchronized method?
- When would you prefer byte streams over character streams while performing I/O operations in Java?
- The ________ method of Connection interface sets the changes made since the previous commit/rollback permanent.