aspose file tools*
The moose likes Beginning Java and the fly likes Overridden method is throwing 2 or more unchecked exceptions How about the overidden method exceptns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Overridden method is throwing 2 or more unchecked exceptions How about the overidden method exceptns" Watch "Overridden method is throwing 2 or more unchecked exceptions How about the overidden method exceptns" New topic
Author

Overridden method is throwing 2 or more unchecked exceptions How about the overidden method exceptns

Anwar Hussain
Ranch Hand

Joined: Jul 24, 2009
Posts: 35
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.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19719
    
  20

Which exceptions you can and cannot throw from a method is a beginner's topic. Moving.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Anwar Hussain
Ranch Hand

Joined: Jul 24, 2009
Posts: 35
Rob Prime wrote:Which exceptions you can and cannot throw from a method is a beginner's topic. Moving.


Hi ,

This is relatec to overriding. so it should not be moved.
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 3018
    
  10
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.
Anwar Hussain
Ranch Hand

Joined: Jul 24, 2009
Posts: 35

Thanks Mike.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overridden method is throwing 2 or more unchecked exceptions How about the overidden method exceptns