This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Mock Exam Errata and the fly likes Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Exception" Watch "Exception" New topic


Mahendra Kamble

Joined: Mar 13, 2001
Posts: 4
Hello Friends
I wanted to the rules of throwing Exceptions when yoy override methods
and why so.

Mahendra Kamble<BR>Software Engineer
Sarang Gurao

Joined: Mar 14, 2001
Posts: 13
Hello Friend,
Hope i can help u in this.
Overridden is done to override the method of the base class and overridden with exception have certain rule.
1. if the base class method has thrown any exception the overridden method can throws that exception or subclass of that exception. this rule apply to only checked exception and not to unchecked exception.
2. If the base class method had throws more than one exception like class xyz throws A,B,C then overridden method can throws anyone of these set of exception in subclass.
1. A
2. B
3. C
4. A,B
5. B,C
6. A,C
7. it can neither throw any exception.
i hope i am right and ur doubt is also clear upto certain limit.
I agree. Here's the link:
subject: Exception
It's not a secret anymore!