|
断而已,一旦匹配成功,就执行其后的语句,一直遭遇break语句为止。(包括default语句在内) 7。D、F IOException异常类是Exception的子类。根据多态性的定义,IOException对象也可以被认为是Exception类型。还要注意在方法声明中抛出异常应用关键字“throws”。 8。D 只有两种情况:大于4时输出“Test1”,小于等于4时输出“Test3”。 9。A、C、D 在正常情况下,打印Test1、Test3、Test4;在产生可捕获异常时打印Test2、Test3、Test4;在产生不可捕获异常时,打印Test3,然后终止程序。注意finally后面的语句总是被执行。 10。B 线程的执行是从方法“run( )”开始的,该方法是由系统调用的。程序员手工调用方法start(),使线程变为可运行状态。
11.Given the following class definition: class A{ protected int i; A(int i){ this.i=i; } } which of the following would be a valid inner class for this class? Select all valid answers: A. class B{ } B. class B extends A{ } C. class B extends A{ B(){System.out.println(“i=”+i);} } D. class B{ class A{} } E. class A{}
12. Which modifier should be applied to a method for the lock of object this to be obtained prior to excution any of the method body? A. synchronized B. abstract C. final D. static E. public
13. The following code is entire contents of a file called Example.java,causes precisely one error during compilation: 1) class SubClass extends BaseClass{ 2) } 3) class BaseClass(){ 4) String str; 5) public BaseClass(){ 6) System.out.println(“ok”);} 7) public BaseClass(String s){ 8) str=s;}} 9) public class Example{ 10) public void method(){ 11) SubClass s=new SubClass(“hello”); 12) BaseClass b=new BaseClass(“world”); 13) } 14) }
Which line would be cause the error? A. 9 B. 10 C. 11 D.12
14. Which statement is correctly declare a variable a which is suitable for refering to an ar上一页 [1] [2] [3] [4] [5] [6] [7] 下一页 |
|
|
|
|
|
|
|