(7-1)定义了如下 的Father类和Derived类,则下面( )语句是正确的。
abstract class Father {
public abstract void call();
}
class Derived extends Father {
public void call() { }
}
abstract class Father {
public abstract void call();
}
class Derived extends Father {
public void call() { }
}
举一反三
- 下面类的定义,哪个是合法的抽象类定义? A: class A { abstract void unfinished() { } } B: class A { abstract void unfinished(); } C: abstract class A { abstract void unfinished(); } D: public class abstract A { abstract void unfinished(); }
- 以下哪个方法不可以加入类Son? class Father{ public void methodOne(int i){} public void methodTwo(int i){} public static void methodTree(int i){} public static void methodFour(int i){} } class Son extends Father{…}
- 给定代码如下: public abstract interface Frobnicate { public void twiddle(String s); } 以下哪个类是正确的?(). A: public abstract class Frob implements Frobnicate { public abstract void twiddle(String s) { } } B: public abstract class Frob implements Frobnicate { } C: public class Frob extends Frobnicate { public void twiddle(Integer i) { } } D: public class Frob implements Frobnicate { public void twiddle(Integer i) { } }
- 若有如下类A的定义,下列哪些类正确继承了该类: abstract class A { abstract void method1(int i); abstract void method2(int j); } A: abstract class B extends A{ void method1( ) { } void method2( ) { } } B: class B { void method1(int i ) { } void method2(int j ) { } } C: class B implements A { void method1(int i ) { } void method2(int j ) { } } D: class B extends A{ public void method1(int x ) { } public void method2(int y ) { } }
- 下面选项中,能够实现子类继承父类的是()。 A: class Son extends Father{} B: class Son call Father{} C: class Son super Father{} D: class Son in Father{}