数组,异常处理,常用类。
static void procedure()
{
try
{
int c[]={1};
c[42]=99;
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println(“数组超越界限异常:”+e);
}
}
public static void main(String args[])
{
try
{
procedure();
int a=args.length;
int b=42/a;
System.out.println(“b=”+b);
}
catch(ArithmeticException e)
{
System.out.println(“除0异常:”+e);
}
}
}
A.程序只输出第12行的异常信息
B.程序只输出第26行的异常信息
C.程序将不输出异常信息
D.程序将输出第12行和第26行的异常信息
16.下面程序抛出了一个“异常”并捕捉它。请在横线处填入适当内容完成程序。
class TrowsDemo
{
static void procedure() throws IllegalAccessExcepton
{
System.out.println(“inside procedure”);
throw___new
____IllegalAccessException(“demo”);
}
public static void main(String args[])
{
try
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库java数组与异常处理复习题(3)在线全文阅读。
相关推荐: