📄 chap4-8.txt
字号:
// 程序4-8
class point{
int x, y;
point(int x, int y){ // point类构造函数
this.x=x;
this.y=y;
System.out.println("父类构造函数被调用!");
}
}
class circle extends point{
int radius;
circle(int r, int x, int y){ // 子类构造函数
super(x, y); // super必须写在构造函数的第一行
radius=r;
System.out.println("子类构造函数被调用!");
}
}
public class testInherence {
public static void main(String args[ ]) {
circle c1;
c1=new circle(1,1,1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -