class point{// 第一个继承例子
int zhijing=8;point(){
System.out.println("调用父类属性---圆的直径:"+"\t"+zhijing);
}
}
class round extends point{
round(){
super();
System.out.println("调用子类默认的构造方法");
}
round (int r){
super();
System.out.println("调用子类youcan的构造方法");
}
void v(){
System.out.println("花园");
}
}
public class HuaYuan {
public static void main(String[] args) {
// TODO Auto-generated method stub
round a =new round();
a.v(); //调用的是无参的
System.out.println();
round b =new round(1);
b.v(); //调用的是无参的
}
}
807

被折叠的 条评论
为什么被折叠?



