5
10
12
17
24
第1题:
A.5
B.10
C.12
D.17
E.24
第2题:
在下列源代码文件Test.java中, ( )是正确的类定义。
A.public class test{
B.public class Test{ public int x=0;public int x=0; public test (intx) public Test (int x){ {this.x=x; this.x=x;} }} }
C.public class Test extends T1,T2{
D.protected class Test extends T2{ public int=0;public int x=0; public Test(int x){Public Test (int x){ this.x=x;this.x=x: }} }}
第3题:
A.public class test { public int x = 0; public test(int x) { this.x = x; } }
B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }
C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }
D.public class
第4题:
给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test { public void cal(int x, int y, int z) { } //A }
第5题:
A.12
B.012
C.10
D.3
第6题:
在下列源代码文件Test.java中,正确定义类的代码是( )。
A.pblic class test { public int x=0; public test(int x) { this. x=x;} }
B.public class Test { public int x=0; public Test(int x) { this. x=x;} }
C.public class Test extends T1,T2{ public int x = 0; public Test(int x){ this. x = x; } }
D.protected class Test extends T2{ public int x = 0; public Test(int x) { this. x = x; } }
第7题:
在下列源代码文件Test.java中,哪个选项是正确的类定义? ( )
A.public class test { public int x=0; public test(int x) { this.x=x; } }
B.public class Test { public int x=0; public Test(int x) { this.x=x; } }
C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }
D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }
第8题:
下面程序的输出结果是什么? class C1{ static int j=0; public void method(int a){ j++; } } class Test extends C1{ public int method(){ return j++; } public void result(){ method(j); System.out.println(j+method()); } public static void main(String args[]){ new Te
A.0
B.1
C.2
D.3
第9题:
以下程序调试结果为:
public class Test {
int m=5;
public void some(int x) {
m=x;
}
public static void main(String args []) {
new Demo().some(7);
}
}
class Demo extends Test {
int m=8;
public void some(int x) {
super.some(x);
System.out.println(m);
}
}
A.5
B.8
C.7
D.无任何输出
E.编译错误
第10题:
1. public class a { 2. public void method1() { 3. try { 4. B b=new b(); 5. b.method2(); 6. // more code here 7. } catch (TestException te) { 8. throw new RuntimeException(te); 9. } 10. } 11. } 1. public class b { 2. public void method2() throws TestException { 3. // more code here 4. } 5. } 1. public class TestException extends Exception { 2. } Given: 31. public void method() { 32. A a=new a(); 33. a.method1(); 34. } Which is true if a TestException is thrown on line 3 of class b?()