题目内容

将下列(A,B,C,D)哪个代码替换下列源文件AA.java中的【代码】不会导致编译错误。interface Com {abstract void start();void stop();}public class AAA implements Com {【代码】}

A. public void start() {System.out.println("start"); }
B. public void start() {System.out.println("start");}public void stop() {System.out.println("stop");}
C. public void stop() {System.out.println("stop");}
D. void start() {System.out.println("start");}void stop() {System.out.println("stop"); }

查看答案
更多问题

将下列(A,B,C,D)哪个代码替换下列源文件Com.java中的【代码】不会导致编译错误。public interface Com {int M = 200;int f();}class ImpCom implements Com {【代码】}

A. public int f() {return 100+M;}
B. int f() {return 100;}
C. public double f(){return 2.6;}
D. public abstract int f();

对于下列代码,下列哪个叙述是错误的?interface Com {int MAX = 100;void stop();abstract void start();}

A. void stop();会导致编译出错。
B. 编译器认为 void stop();就是public abstract void stop();
C. 编译器认为 abstract void start();就是public abstract void start();
D. 编译器认为 int MAX = 100;就是 public static final int MAX = 100;

下列【1】、【2】、【3】、【4】注释标注的哪行代码有错误?public interface Com {abstract void cry();//【1】public int x = 0;//【2】}abstract class Animal implements Com {public abstract void cry();}class E {public static void main(String args[]){Animal dog = null ; // 【3】dog = new Animal(); // 【4】}}

A. 【1】
B. 【2】
C. 【3】
D. 【4】

给出下列【代码】注释标注的代码的输出结果。interface Com {public abstract char cry();}class Dog implements Com{public char cry(){return 'D';}}class Cat implements Com{public char cry(){return 'C';}}class People {Com com;char seeCry(Com com){return com.cry();}}public class E {public static void main(String args[]){People p = new People ();char c1 = p.seeCry(new Dog());char c2 = p.seeCry(new Cat());System.out.printf("%c:%c",c1,c2);//【代码】}}

答案查题题库