请教一个关于java的英文题目.“15.Which of the following statements”...15.Which of the following statements is true about exceptions?a) The throwing method has to handle them b) The catching method has to handle them c) You need to add an
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 10:57:46
请教一个关于java的英文题目.“15.Which of the following statements”...15.Which of the following statements is true about exceptions?a) The throwing method has to handle them b) The catching method has to handle them c) You need to add an
请教一个关于java的英文题目.“15.Which of the following statements”...
15.Which of the following statements is true about exceptions?
a) The throwing method has to handle them
b) The catching method has to handle them
c) You need to add an exception block
d) They are only used for files
e) They replace programming by contract
15e
能不能简单说明一下为什么其他的选项不对?
请教一个关于java的英文题目.“15.Which of the following statements”...15.Which of the following statements is true about exceptions?a) The throwing method has to handle them b) The catching method has to handle them c) You need to add an
异常,可以抛可以抓.
第一个就说是抛异常必须处理它.显然错的啊.都抛走了,throw还怎么handle?
至于捕捉异常,catch(Exception e).打个比方,你抓到一只小鸟,怎么办?
对,我怎么知道怎么办,想怎么办就怎么办.当然最通常的方法就是将异常打印出来.就像是你告诉别人,我抓到是一直什么名字的鸟.但是我抓到了我也可以什么都不做,默默的藏着.所以也不是has to handle.
而在异常这里加锁.加锁是为了程序的同步性,再说了
根本不影响具体的 try catch/throw工作.
这个d选项.仅仅用在files上?读取文件还是对文件抛/捕捉异常?
异常是人为可以修正以及避免的.只要是人的逻辑有不足的地方就会存在异常.
最后一个 我真翻译不来.我理解是是用协议来代替编程.几个意思.不懂.