黑马程序员技术交流社区
标题:
大牛们帮我看看有没有错误
[打印本页]
作者:
zhangwenquan
时间:
2016-1-23 12:13
标题:
大牛们帮我看看有没有错误
class Dome {
public void root() {
String sSite = "土壤中";
String sFunction = "吸收养份";
print("位置:"+sSite);
print("功能:"+sFunction);
}
public void bolo() {
String sSite = "地面";
String sFunction = "传递养份";
print("位置:"+sSite);
print("功能:"+sFunction);
}
public void branch() {
String sSite = "树干上";
String sFunction = "传递养份";
print("位置:"+sSite);
print("功能:"+sFunction);
}
public void leaf() {
String sSite = "树梢";
String sFunction = "光合作用";
String sColor = "绿色";
print("位置:"+sSite);
print("功能:"+sFunction);
print("颜色:"+sColor);
}
public void print(Object oPara) {
System.out.println(oPara);
}
public static void main(String[] arges) {
tree t = new tree();
t.print("描述一棵树:");
t.print("树根:");
t.root();
t.print("树干:");
t.bolo();
t.print("树枝:");
t.branch();
t.print("树叶:");
t.leaf();
}
}
class osier extends tree {
public void leaf() {
super.leaf();
String sShape = "长形";
super.print("形状:"+sShape);
}
public void flower() {
print("哈哈,柳树没有花!!");
}
public static void main(String[] args) {
osier o = new osier();
o.print("柳树树根:");
o.root();
o.print("柳树树干:");
o.bolo();
o.print("柳树树枝:");
o.branch();
o.print("柳树树叶:");
o.leaf();
o.print("柳树花:");
o.flower();
}
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2