boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Ask a simple question about throw exception, bow bow bow
相关主题
Can't figure out: why can't append again
ZT: 关于性爱的多线程问题研究(一)
a fun coding question
跪求大牛指点Java,看不懂什么意思。
一个Java程序员的话(4)--续第一章
在线等,
Help! ClassCastException
Urgent!
ERROR!java.io.RandomAccessFile.readInt
question about Exeption
相关话题的讨论汇总
话题: bow话题: exception话题: methoda话题: aexception话题: throws
进入Java版参与讨论
1 (共1页)
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.

1 (共1页)
进入Java版参与讨论
相关主题
question about Exeption
Help: UnknownHostException
BufferedWriter里的write()
关于char和int的问题
A question on easyMock2
Spring Library Bug?
java synchronized 问题 (转载)
关于 BufferedReader 问题
java 随机数 nextInt(int n)的问题
very weird problem
相关话题的讨论汇总
话题: bow话题: exception话题: methoda话题: aexception话题: throws