JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Originally posted by Marilyn de Queiroz:
"If I override getX in class B, I am not allowed
to throw an exception which is not known the exception or a superclass of the exception thrown by the baseclass."
RuntimeExceptions are exempt from the rule. They are an exception to the Exception override rule.![]()
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
SCJP2
not possible to say
public void getX ( ) throws Exception { }
But why is it possible to say:
public void getX ( ) throws RuntimeException { }
SCJP 1.4<br /><a href="http://www.cise.ufl.edu/~sih" target="_blank" rel="nofollow">www.cise.ufl.edu/~sih</a>
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Don't get me started about those stupid light bulbs. |