I have the method signature which looks like below
I want to override this method .Please, let me know the restrictions on the throws list(Exception list) of the overidden method.I want to know the possible combination of throws exceptions of the overiding method.
No, I think it's still a beginner topic. Overriding is pretty fundamental in Java; you can't advance without knowing how it works. I'm not saying it's easy, necessarily. But it is a requirement for beginners to understand. Even if the overridden method throws an exception.
Do you understand checked exceptions? Basically, your overriding method cannot throw any new checked exceptions. You can throw any unchecked exception you want, and you can throw anything that was declared in the overridden method's throws statement, or any subclass of what was declared there. You can also throw less than was declared there. Your overriding method may even throw no checked exceptions at all - and thus, it has no need to declare anything.
posted 10 years ago
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad: