您的位置:首页 > 其它

Chapter 6:Inheritance and Composition

2005-02-25 17:23 459 查看
Insect {
i = 9;
j;
Insect() {
prt( + i +  + j);
j = 39;
}
x1 =
prt();
prt(String s) {
System.out.println(s);
47;
}
}

Beetle  Insect {
k = prt();
Beetle() {
prt( + k);
prt( + j);
}
x2 =
prt();
prt(String s) {
System.out.println(s);
63;
}
main(String[] args) {
prt();
Beetle b =  Beetle();
}
}

该程序的输出如下:
Insect.x initialized
Beetle.x initialized
Beetle constructor
i = 9, j = 0
Beetle.k initialized
k = 63
j = 39
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息