Topic:   Can we modify the throws clause of the superclass method while overriding it in the subclass?
Mar 09, 2021 11:18 1 Replies 107 Views ROHAN

Can we modify the throws clause of the superclass method while overriding it in the subclass?

Prev Next
Topic Replies (1)
  1. 1
    idnkx user

    VAMSI

    Yes, we can modify the throws clause of the superclass method while overriding it in the subclass. However, there are some rules which are to be followed while overriding in case of exception handling.
    o If the superclass method does not declare an exception, subclass overridden method cannot declare the checked exception, but it can declare the unchecked exception.
    o If the superclass method declares an exception, subclass overridden method can declare same, subclass exception or no exception but cannot declare parent exception.

Leave a Reply
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect