JAVA面向对象编程-试卷B
所属分类:其他
开发工具:Java
文件大小:15KB
下载次数:1
上传日期:2017-11-10 20:39:45
上 传 者:弑神唐三
说明: 定义一个交通工具类Traffic,该类包含属性:车轮的数量、行驶速度;同时还包含行驶的方法,并包含有参和无参的构造方法。请分别定义汽车类Car(包含油耗的属性,有参的构造方法)、火车类Train(无参的构造方法)、飞机类Plane(包含最大航程的属性,包含无参和有参的构造方法),让他们继承Traffic,并重写行驶的方法。在测试类中分别创建三个子类的对象,并调用行驶的方法。(
(A vehicle class Traffic is defined, which contains attributes: the number of wheels, the speed of travel, and the method of driving, including the parametric and parametric construction methods. Please define auto Car (with the construction method of ginseng contains fuel properties), Train (train class construction method of no arguments), class Plane (including aircraft attributes, the maximum range contains no parameters and construction method of ginseng), let them inherit the Traffic method, and override driving. In the test class, three objects of the subclass are created, and the driving method is called. ()
文件列表:[举报垃圾]
JAVA面向对象编程-试卷B.doc
近期下载者:
相关文件:
收藏者: