文件名称:Example

  • 所属分类:
  • JSP源码/Java
  • 资源属性:
  • [Java] [源码]
  • 上传时间:
  • 2012-11-26
  • 文件大小:
  • 5kb
  • 下载次数:
  • 0次
  • 提 供 者:
  • 覃**
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容均来自于网络,请自行研究使用

继承

1.  实验目的

巩固如下概念:

子类的继承性,子类对象的创建过程,成员变量的继承与隐藏,方法的继承与重写。

2.  实验要求

(1)编写一个Java应用程序,除了主类外,该程序中还要定义4个类:People、ChinaPeople、AmericanPeople和BeijingPeople类,要求如下:

   People类具有访问权限是protected的double型成员:height和weight,以及public void speakHello()、public void averageHeight()和public void averageWeight()方法。

   ChinaPeople是People类的子类,新增了public void chinaGongfu()方法。要求重写父类的public void speakHello()、public void averageHeight()和public void averageWeight()方法。

   AmericanPeople是People类的子类,新增了public void americanBoxing()方法。要求重写父类的public void speakHello()、public void averageHeight()和public void averageWeight()方法。

   BeijingPeople是ChinaPeople类的子类,新增了public void beijingOpera()方法。要求重写父类的public void speakHello()、public void averageHeight()和public void averageWeight()方法。-Inherit

1. Purpose of the experiment

Consolidation of the following concepts:

Subclass inheritance, sub-class object creation, inheritance and hiding member variables, methods, inheritance and override.

2. Experimental requirements

(1) Write a Java application, in addition to the main class of things, the program also defined four categories: People, ChinaPeople, AmericanPeople and BeijingPeople class, requirements are as follows:

 People have access to a protected class of double-type members: height and weight, as well as public void speakHello (), public void averageHeight () and public void averageWeight () method.

 ChinaPeople People class is a subclass of added public void chinaGongfu () method. As requested by the parent class public void speakHello (), public void averageHeight () and public void averageWeight () method.

 AmericanPeople People class is a subclass of added public void americanBoxing () method. As requested by the parent cl
(系统自动生成,下载前可以参看下载内容)

下载文件列表

Example.doc

Example.class

Example.java

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org