数组,异常处理,常用类。
}
System.out.println(greeting[i]);
}
_________catch________(ArrayIndexOutOfBoundsException e) {
System.out.println(“Re-setting Index Value”);
i=-1;
finally
{
System.out.println(“This is always printed”);
}
i++;
}
}
}
三、判断题
1.String str="abcdefghi"; char chr=str.charAt(9); ( × )
2.char[] chrArray={ 'a', 'b', 'c', 'd', 'e', 'f', 'g'}; char chr=chrArray[6]; ( √ )
3.int i,j; boolean booleanValue=(i==j); ( × )
4.int intArray[]={0,2,4,6,8}; int length=int Array.length();( × )
5.String str="abcedf"; int length=str.length; ( × )
6.int[] intArray[60]; ( × )
7.char[] str="abcdefgh"; ( × )
8.说明或声明数组时不分配内存大小,创建数组时分配内存大小。( √ )
9.Integer i = (Integer.valueOf("926")).intValue();( √ )
10.String s = (Double.valueOf("3.1415926")).toString(); ( √ )
11.Integer I = Integer.parseInt("926");( √ )
12.Arrays类主要对数组进行操作。( √ )
四、程序分析题
1.分析下面的程序,写出运行结果。
public class Exercises5_1 {
String str = new String("Hi !");
char[] ch = { 'L', 'i', 'k', 'e' };
public static void main(String args[]) {
Exercises5_1 ex = new Exercises5_1();
ex.change(ex.str, ex.ch);
System.out.print(ex.str + " ");
System.out.print(ex.ch);
}
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库java数组与异常处理复习题(5)在线全文阅读。
相关推荐: