题目内容

下列选项中,( )是正确的

A. final类不可以有子类
B. abstract类中只可以有abstract方法
C. abstract类中可以有非abstract方法,但该方法不可以用final修饰
D. 可以同时用final和abstract修饰同一个方法

查看答案
更多问题

挑错题:A、B、C、D注释标注的哪行代码有错误?abstract class AAA {final static void speakHello() {} //Afinal abstract void cry(); //Bstatic final int f(){ return 0 ;} //Cabstract float g(); //D}

A
B
C
D

挑错题:A、B、C、D注释标注的哪行代码有错误?abstract class Animal {int m =100;}class Dog extends Animal{double m;}public class E {public static void main(String args[]){Animal animal = null; //ADog dog = new Dog();animal = dog; //Bdog.m = 3.14; //Canimal.m = 3.14; //D}}

A
B
C
D

阅读程序题(给出下列【代码】注释标注的代码的输出结果)class A {int f(int x,int y) {return x+y;}}class B extends A {int f(int x,int y) {int m = super.f(x,y)+10;return m;}}public class E {public static void main(String args[]) {A a = new B();System.out.println(a.f(2,10)); // 【代码】}}

阅读程序题(给出下列【代码】注释标注的代码的输出结果)class Animal {int m = 100;public int seeM(){return m;}public int getM(){return m;}}class Dog extends Animal{int m = 6;public int seeM(){return m;}}public class E {public static void main(String args[]){Animal animal = null;Dog dog = new Dog();animal = dog;System.out.printf("%d:%d:%d",dog.seeM(),animal.seeM(),animal.getM()); //【代码】}}

答案查题题库