單項(xiàng)選擇題

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.

題目列表

你可能感興趣的試題

微信掃碼免費(fèi)搜題