Ex0 caught
exception caught
Compilation fails because of an error at line 2.
Compilation fails because of an error at line 6.
第1题:
如果有-个类MyFrame是Frame的子类,但它不能被实例化,请写出该类的声明头为( )。
A.abstract class Frame. extends MyFrame
B.abstract class MyFrame. extends Frame
C.class MyFrame. abstract extends Frame
D.class Frame. abstract extends MyFrame.
第2题:
定义一个类名为MyClass的类,并且该类可被所有类访问,那么该类的正确声明应为()
A、private class MyClass extends Object
B、class MyClass extends Object
C、public class MyClass
D、protected class MyClass extends Object
第3题:
A.class x { .... }
B.public x extends y { .... }
C.public class x extends y { .... }
D.class x extends y implements y1 { .... }
第4题:
Which statements, when inserted at the indicated position in the following code, will cause a runtime exception when attempting to run the program?() class A {} class B extends A {} class C extends A {} public class Q3ae4 { public static void main(String args[]) { A x = new A(); B y = new B(); C z = new C(); // insert statement here } }
第5题:
public class TestA{ public void methodA() throws IOException{ //…… } } public class TestB extends TestA{ public void methodA() throws EOFException{ //…… } } public class TestC extends TestA{ public void methodA() throws Exception{ //…… } } 当编译类TestC的时候,结果是哪项?()
第6题:
如果有一个类MyFrame是Frame的子类,但它不能被实例化,请写出该类的声明头为( )。
A.abstract class Frame. extends MyFrame
B.abstract class MyFrame. extends Frame
C.class MyFrame. abstract extends Frame
D.class Frame. abstract extends MyFrame.
第7题:
Class TestException 1. public class TestException extends Exception { 2. } Class a: 1. public class a { 2. 3. public String sayHello(String name) throws TestException { 4. 5. if(name == null) { 6. throw new TestException(); 7. } 8. 9. return “Hello “+ name; 10. } 11. 12. } A programmer wants to use this code in an application: 45. A a=new A(); 46. System.out.println(a.sayHello(”John”)); Which two are true?()
第8题:
A.public class MinMax<?> {
B.public class MinMax<? extends Number> {
C.public class MinMax<N extends Object> {
D.public class MinMax<N extends Number> {
E.public class MinMax<? extends Object> {
F.public class MinMax<N extends Integer> {
第9题:
1. class SuperClass { 2. public a geta() { 3. return new a(); 4. } 5. } 6. class SubClass extends SuperClass { 7. public b geta() { 8. return new b(); 9. } 10. } Which is true?()
第10题:
现在有两个类A、B,以下描述中表示B继承自A的是()