r****c 发帖数: 2585 | 1 I just have a piece of code as follows
public void methodA()
{
methodB(paramA, new Class() throws AException {
Noname class
}
}
According to common jave exception practice, should I also modify methodA to
throws AException? | t*****s 发帖数: 124 | 2 yes, if you don't want to catch AException in methodA
【在 r****c 的大作中提到】 : I just have a piece of code as follows : public void methodA() : { : methodB(paramA, new Class() throws AException { : Noname class : } : : } : According to common jave exception practice, should I also modify methodA to : throws AException?
| g*****g 发帖数: 34805 | 3 Usually you don't extend RuntimException unless you want to
halt the system when the exception is throwed. | m******t 发帖数: 2416 | 4
Technically, an uncaught exception does not halt the entire jvm (if that's
what you meant by "system"). If I'm not mistaken, it ends up killing the
thread throwing the exception - of course, if that thread happens to be the
main GUI thread in a Swing app, it would indeed appear to have halted the
entire system. 8-)
【在 g*****g 的大作中提到】 : Usually you don't extend RuntimException unless you want to : halt the system when the exception is throwed.
|
|