Error表示系统级的错误
Error表示程序不必处理的异常
Exception表示需要捕捉的异常
Exception表示需要程序进行处理的异常
第1题:
下列程序的运行结果是
public class test{
private String[] data={“10”,“10.5”};
public void fun(){
double s=0;
for(int i=0;i<3;i++){
try{
s=s+Integer .parseInt(data[i]);
}catch(Exception e){
System.out.print(“errorl:”+data[i]);
}
}
}
public static void main(String[]args){
try{
testd=new test();
d .fun();
}catch(Exception e){
System.out.printIn(“error2”);
}
}
}
A.errorl:10.5
B.error2
C.errorl:10.5 error2
D.以上都不对
第2题:
自定义的异常类可从下列( )类继承。
A.error类
B.awtercor
C.virtualmachineerror
D.exception及其子集
第3题:
A.Error表示系统级的错误
B.Error表示程序不必处理的异常
C.Exception表示需要捕捉的异常
D.Exception表示需要程序进行处理的异常
第4题:
error和exception有什么区别?
第5题:
A、自定义异常要继承Exception类
B、自定义异常继承Exception类后具有可抛性
C、自定义异常可以在构造方法中用super关键字传递异常信息给父类
D、自定义异常必须继承Error类
第6题:
GiventhisfragmentfromaJavaEEdeploymentdescriptor:341.<error-page>342.<exception-type>java.lang.Throwable</exception-type>343.<location>/mainError.jsp</location>344.</error-page>345.<error-page>346.<exception-type>java.lang.ClassCastException</exception-type>347.<location>/castError.jsp</location>348.</error-page>IfthewebapplicationassociatedwiththefragmentabovethrowsaClassCastException.Whichstatementistrue?()
A.Thedeploymentdescriptorisinvalid.
B.ThecontainerinvokesmainError.jsp.
C.ThecontainerinvokescastError.jsp.
D.NeithermainError.jspnorcastError.jspisinvoked.
第7题:
自定义的异常类可从下列哪个类继承?( )。
A.Error类
B.AWTError
C.VirtualMachineError
D.Exception及其子集
第8题:
A.Error表示系统级的错误。
B.Error表示程序不必处理的异常。
C.Exception表示需要捕捉的异常。
D.Exception表示需要程序进行处理的异常。
第9题:
A.继承java.lang.Error的类属于checkedexception
B.checked异常继承java.lang.Exception类
C.unchecked异常继承java.lang.RuntimeException类
D.NullPointerException,IllegalArgumentException属于uncheckedexception
第10题:
Error和Exception下列说法正确的是()。