wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exception" Watch "Exception" New topic
Author

Exception

adam Lui
Ranch Hand

Joined: Sep 03, 2007
Posts: 186
"if the overridden method does not throw any exception, the overriding method cannot throw any checked exception, but it can still throw a runtime exception"

does it mean...

class A {
void methodA {}
}
class B extends A{
void methodA throws ArrayIndexOutOfBoundsException, ClassCastException {}
}

is legal??
Yogesh Baraskar
Ranch Hand

Joined: Oct 07, 2007
Posts: 33
Hi

This is perfectly legal.
You can declare any runtime exceptions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Exception