网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
判断题
用catch(Exception exception)语句可以捕获所有异常和错误。
A
对
B
错
参考答案
参考解析
解析:
暂无解析
更多 “判断题用catch(Exception exception)语句可以捕获所有异常和错误。A 对B 错” 相关考题
考题
下列说法中错误的是( )。A.捕获异常在调用方法时用throw子句捕获并处理B.异常对象用new来创建C.Java语言中的类库中已定义有许多异常类可利用D.Throwable类分为Error和Exception两子类
考题
If an exception is thrown inside a catch block, will the finally block be still be called?(如果catch块捕获了一个异常,那么finally块还会被调用吗)
考题
下列错误使用异常的做法是()A、在程序中使用异常处理还是使用错误返回码处理,根据是否有利于程序结构来确定,并且异常和错误码不应该混合使用,推荐使用异常B、一个方法不应抛出太多类型的异常。throws/exception子句标明的异常最好不要超过三个C、异常捕获尽量不要直接catch(Exceptionex),应该把异常细分处理D、程序内抛出的异常本身就可说明异常的类型、抛出条件,可不填写详细的描述信息。捕获异常后用exception.toString()取到详细信息后保存
考题
在Java的异常处理语句try-catch-final中,以下描述不正确的是()。A、try后面是可能产生异常的代码,catch后面是捕获到某种异常对象时进行处理的代码,final后面是没有捕获到异常时要执行的代码B、try后面是可能产生异常的代码,catch后面是捕获到某种异常对象时进行处理的代码,final后面是无论是否捕获到异常都必须执行的代码C、catch语句和final语句都可以缺省D、catch语句用来处理程序运行时的非致命性错误,而final语句用来处理程序运行时的致命性错误E、当程序运行时抛出的异常是cathe语句中异常的子类,异常也会被捕捉执行相应的catch语句
考题
try { int x = 0; int y = 5 / x; } catch (Exception e) { System.out.println(“Exception”); } catch (ArithmeticException ae) { System.out.println(“Arithmetic Exception”); } System.out.println(“finished”); What is the result?() A、 finishedB、 ExceptionC、 Compilation fails.D、 Arithmetic Exception
考题
下面有关JAVA异常类的描述,说法错误的是()。A、异常的继承结构:基类为Throwable,Error和Exception继承Throwable,RuntimeException和IOException等继承ExceptionB、非RuntimeException一般是外部错误,其必须被 try{}catch语句块所捕获C、Error类体系描述了Java运行系统中的内部错误以及资源耗尽的情形,Error不需要捕捉D、RuntimeException体系包括错误的类型转换、数组越界访问和试图访问空指针等等,必须被 try{}catch语句块所捕获
考题
以下关于异常捕获的原则中,错误的是()A、 RuntimeException 可以不被捕获,Java会自动处理运行期异常。B、 先列出子类,后列出父类。C、 先列出具体的异常类,后列出通用的异常类。D、 Exception类必须出现,而且必须作为catch块中第一个匹配的类。
考题
现有: void topGo() { try { middleGo(); } catch (Exception e) { System.out.print("catch"); } } void middleGo() throws Exception { go(); system.out.print("late middle"); } void go() throws ExceptiOn { throw new Exception(); } 如果调用 topGo () ,则结果为:() A、 late middleB、 catchC、 late middle catchD、 catch Iate middle
考题
class Birds { public static void main(String [] args) { try { throw new Exception(); } catch (Exception e) { try { throw new Exception(); } catch (Exception e2) { System.out.print("inner "); } System.out.print("middle "); } System.out.print("outer "); } } 结果为:() A、innerB、inner outerC、middle outerD、inner middle outer
考题
单选题现有: void topGo() { try { middleGo(); } catch (Exception e) { System.out.print("catch"); } } void middleGo() throws Exception { go(); system.out.print("late middle"); } void go() throws ExceptiOn { throw new Exception(); } 如果调用 topGo () ,则结果为:()A
late middleB
catchC
late middle catchD
catch Iate middle
考题
单选题try { int x = 0; int y = 5 / x; } catch (Exception e) { System.out.println(“Exception”); } catch (ArithmeticException ae) { System.out.println(“Arithmetic Exception”); } System.out.println(“finished”); What is the result?()A
finishedB
ExceptionC
Compilation fails.D
Arithmetic Exception
考题
单选题以下关于异常捕获的原则中,错误的是()A
RuntimeException 可以不被捕获,Java会自动处理运行期异常。B
先列出子类,后列出父类。C
先列出具体的异常类,后列出通用的异常类。D
Exception类必须出现,而且必须作为catch块中第一个匹配的类。
考题
( 难度:中等)关于异常(Exception),下列描述正确的是A.异常的基类为Exception,所有异常都必须直接或者间接继承它B.异常可以用try{ . . .}catch(Exception e){ . . .}来捕获并进行处理C.如果某异常继承RuntimeException,则该异常可以不被声明D.异常可以随便处理,而不是抛给外层的程序进行处理
热门标签
最新试卷