This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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??


boolean b = true;<br />System.out.println ("I believe in Java.<br />Java will make my dream come " + b);
Yogesh Baraskar
Ranch Hand

Joined: Oct 07, 2007
Posts: 33
Hi

This is perfectly legal.
You can declare any runtime exceptions
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Exception
 
Similar Threads
Exeption Handling
simple question about overriding
Overriding with Exceptions
Exception test
Reg. Exception Handling