欢迎来到易学考试网 易学考试官网
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

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.

点击查看答案&解析

相关考题

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题