标题:为什么TestCylinder4.java在运行时会出现如下问题
只看楼主
光明左使
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-8-16
 问题点数:0 回复次数:4 
为什么TestCylinder4.java在运行时会出现如下问题

为什么TestCylinder4.java在运行时会出现如下问题:如图



涉及以下程序:
package c.czg;

public interface Shape1
{
public abstract double area();
public abstract double volume();
public abstract String getName();
}

package c.czg;
import c.czg.Shape;

public class Point4 extends Object implements Shape1
{
protected int x,y;

public Point4()
{
setPoint( 0,0 );
}

public Point4( int xCoordinate,int yCoordinate )
{
setPoint( xCoordinate,yCoordinate );
}

public void setPoint( int xCoordinate,int yCoordinate )
{
x = xCoordinate;
y = yCoordinate;
}

public double getX()
{
return x;
}

public double getY()
{
return y;
}

public String toString()
{
return "[" + x + "," + y + "]";
}

public double area()
{
return 0.0;
}

public double volume()
{
return 0.0;
}

public String getName()
{
return "Point:";
}
}

package c.czg;

import c.czg.Point4;

public class Circle4 extends Point4
{
protected double radius;

public Circle4()
{
setRadius( 0.0 );
}

public Circle4( double circleRadius,int xCoordinate,int yCoordinate )
{
super( xCoordinate,yCoordinate );
setRadius( circleRadius );
}

public void setRadius( double circleRadius )
{
radius = ( circleRadius >= 0.0 ? circleRadius : 0.0 );
}

public double getRadius()
{
return radius;
}

public double area()
{
return Math.PI * radius * radius;
}

public String toString()
{
return "Center = " + super.toString() +
"; Radius = " + radius;
}

public double volume()
{
return 0.0;
}

public String getName()
{
return "Circle:";
}
}

package c.czg;

import c.czg.Circle4;

public class Cylinder4 extends Circle4
{
protected double height;

public Cylinder4()
{
setHeight(0.0);
}

public Cylinder4( double cylinderHeight,double cylinderRadius,int xCoordinate,int yCoordinate )
{
super( cylinderRadius,xCoordinate,yCoordinate );
setHeight( cylinderHeight );
}

public void setHeight( double cylinderHeight )
{
height = ( cylinderHeight >= 0.0 ? cylinderHeight : 0.0 );
}

public double getHeight()
{
return height;
}

public double area()
{
return 2 * super.area() + Math.PI * radius * height;
}

public double volume()
{
return super.area() * height;
}

public String toString()
{
return super.toString() + "; Height = " + height;
}

public String getName()
{
return "Cylinder:";
}
}

搜索更多相关主题的帖子: 时会 czg abstract public 
2006-12-06 18:36
angeloc
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:36
帖 子:1353
专家分:0
注 册:2006-11-21
得分:0 
看不见图。。。

老牛明知夕阳晚,不用扬鞭自奋蹄; Angelo\'s BLOG
2006-12-06 22:00
光明左使
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-8-16
得分:0 
运行一下就可以了,望解决,急!!!!!!!!!!!!!!!!!

以剑论道,以道搏剑,快意恩仇,却是何等的孤独!!
2006-12-08 20:10
angeloc
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:36
帖 子:1353
专家分:0
注 册:2006-11-21
得分:0 
你把错误信息发上来看

老牛明知夕阳晚,不用扬鞭自奋蹄; Angelo\'s BLOG
2006-12-08 21:16
しΟν∈→鱈
Rank: 1
等 级:新手上路
威 望:2
帖 子:369
专家分:0
注 册:2006-10-25
得分:0 
...楼主以后不要这样发了   看的眼都花了  
发问题要把你的错误  异常之类的信息帖上来

开开心心的过&玩每一天!!!!
2006-12-09 11:16



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-107666-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.122444 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved