计算机二级java辅导:构造方法的继承计算机等级考试
文章作者 100test 发表时间 2010:01:01 12:26:00
来源 100Test.Com百考试题网
构造方法是一种特殊的方法,它的继承规则比较简单,而且与普通方法有较大的区别
1 无参数构造方法的构造方法示例
class hasConstructor{
protected int x=100.
public void showMsg(){
System.out.println("this is a method in ancesstor").
}
public hasConstructor(){
System.out.println("this is a constructor in ancestor without parameter").
}
public hasConstructor(int ix){
System.out.println("this is a constructor in ancestor with parameter").
}
}