设为首页 加入收藏

TOP

计算机二级java辅导:构造方法的继承
2014-11-20 00:20:14 】 浏览:4736
Tags:计算机 二级 java 辅导 构造 方法 继承

  构造方法是一种特殊的方法,它的继承规则比较简单,而且与普通方法有较大的区别


  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");


  }


  }


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇计算机二级辅导:java对象排序 下一篇Javaweb应用中自动生成文章html页..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目