阅读下列程序,请写出该程序的输出结果。
class Tree
private String name;public boolean flower;
public int birthYear;
Tree(String n,boolean f,int y)name=n;flower=f;birthYear=y;
public void setName(String n)name=n;
public String getName() return name;
public void printTree (String str)
System. out. println(str);System. out. println("Name:"+name);
System. out.println("Birth Year:"+birthYear);
System. out. println("Flower:"+flower);
class PineTree extends Tree
public boolean coniferous=true;
PineTree(String n,boolean f,int y,boolean c)super(n,f,y);coniferous=c;
public void printTree(String str)
super. printTree (str);
System. out. println("Coniferous:"+coniferous);
class Test32
public static void main(String[] args)
Tree fOb=new Tree("May Flower",true,1980);
PineTree sOb=new PineTree("Pine",false,2000,true);
fOb. printTree("fOb:");sOb. printTree("sOb:");
参考答案:fOb:
Name:May Flower
Birch Year:1980
Flower:true
sOb:
Name:Pine
Birth Year:2000
Flower:false
Coniferous:true