可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

public class Plant {&e


public class Plant {  private String name;  public Plant(String name) { this.name = name; }  public String getName() { return name; }  }  public class Tree extends Plant {  public void growFruit() { }  public void dropLeaves() { }  }  Which is true?() 

  • A The code will compile without changes.
  • B The code will compile if public Tree() { Plant(); } is added to the Tree class.
  • C The code will compile if public Plant() { Tree(); } is added to the Plant class.
  • D The code will compile if public Plant() { this(”fern”); } is added to the Plant class.
  • E The code will compile if public Plant() { Plant(”fern”); } is added to the Plant class.
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

1、class java {  public&e

class java { public static void main(String [] java) {  for (int Java = 1; Java&e...

2、public class TestA{ &e

public class TestA{  public void methodA() throws IOException{  //……  }  }  publi...

3、1. public class Test&e

1. public class Test { 2. int x= 12; 3. public void method(int x) { 4. x+=x;&ensp...

4、class Flow {  public&e

class Flow { public static void main(String [] args) { try { System.out.print("before "); ...

5、public class Starter e

public class Starter extends Thread { private int x= 2; public static void main(String[] args...

6、public class Delta {&e

public class Delta { static boolean foo(char c) { System.out.print(c); return true; } public&e...