题目内容

()是指子类中的一个方法与父类中的方法有相同的方法名并具有相同参数和类型的参数列表。

A. 重载方法;
B. 覆盖方法;
C. 强制类型转换;
D. 以上都不对;

查看答案
更多问题

以下哪些代码块能够编译通过?()

A. class Fruit { }public class Orange extends Fruit {public static void main(String[]args){Fruit f=new Fruit();Orange o=f;}};
B. class Fruit {}public class Orange extends Fruit {public static void main(String[]args){Orange o=new Orange();Fruit f=o;}};
C. interface Fruit {}public class Apple implements Fruit {public static void main(String[]args){Fruit f=new Fruit();Apple a=f;}};
D. interface Fruit {}public class Apple implements Fruit {public static void main(String []args){Apple a=new Apple();Fruit f=a;}};
E. interface Fruit {}class Apple implements Fruit {}class Orange implements Fruit {}public class MyFruit {public static void main(String []args){Orange o=new Orange();Fruit f=o;Apple a=f;}}

下面哪些是合法的语句(以下Panel、Applet和Frame类来自于java.awt包,请查阅相关的JavaDoc文档来了解它们是否有继承关系)?()

A. Object o = new String("abcd");
Boolean b = true;
C. Panel p = new Frame();
D. Applet a = new Panel();
E. Panel p = new Applet();

请将以下程序补充完整。_______ class C {abstract void callme();void metoo {System.out.println(“类C的metoo()方法”);}}class D_______C {void callme() {System.out.println(“重载C类的callme()方法”);}}public class Abstract {public static void main(String args[]){}C c=__________D();c.callme();c.metoo();}}

继承有哪些优点和缺点?

答案查题题库