文件名称:ShapeExp2
- 所属分类:
- JSP源码/Java
- 资源属性:
- [Java] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- 李*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
个人原创代码:矩形、圆形、五角星等形状的操作。编写Java Application程序,创建一个接口Shape,其中有抽象方法area,类Circle 、Rectangle实现area方法计算其面积并返回。又有Star实现Shape的area方法,其返回值是0,Star类另有一返回值boolean型方法isStar;在main方法里创建一个Vector,根据随机数的不同向其中加入Shape的不同子类对象(如是1,生成Circle对象;如是2,生成Rectangle对象;如是3,生成Star对象)。然后将Vector中元素依次取出,判断其是否为Star类。如是返回其是个Star。否则返回其面积。-Personal original code: the operation of the rectangular, circular, five-pointed star shape.The Shape to write java application program to create an interface, including the area of abstract methods, the Circle class, the Rectangle area method to calculate the area and return. Another Star Shape of area method, the return value is 0, the Star class, otherwise returns the value of a boolean method isStar in the main method to create a Vector, according to the random number to join Shape subclass object (in the case of 1, generate a Circle object case 2, generate the Rectangle object the case of three objects generate Star). Vector elements turn out to determine whether it is the Star class. The case of return is a Star. Otherwise, return to their area.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
本Java程序设计详细要求.txt
ShapeExp2.java
ShapeExp2.java