java类 - Java / Java SE
要求圆柱继承圆,圆继承点。写出来很多错,请人指点
Java code:
class Point
{
int x, y;
public Point()
{
x = 0;
y = 0;
}
public Point(int newx, int newy)
{
x = newx >= 0 ? newx : 0;
y = newy >= 0 ? newy : 0;
}
public int get_x()
{
return x;
}
public int get_y()
{
return y;
}
public void set_x(int temp)
{
x = temp;
}
public void set_y(int temp)
{
y = temp;
}
}
class Circle extends Point
{
double r;
public Circle()
{
r = 0.0;
}
public Circle(int x, int y, double r)
{
super(x,y);
this.r = r;
}
public double get_r()
{
return r;
}
public void set_r(double newr)
{
this.r = newr;
}
public double cir_c()
{
return 2 * 3.1415926 * r;
}
public double cir_s()
{
return 3.1415926 * r * r;
}
}
class Column extends Circle
{
double h;
public Column()
{
h = 0;
}
public Column(int x, int y, double r, double h)
{
super(x, y, r);
this.h = h;
}
public double get_h()
{
return h;
}
public void set_h(double newh)
{
this.h = newh;
}
public double col_s()
{
return (2 * 3.1415926 * r * r + h * 2 * 3.1415926 * r);
}
public double col_v()
{
return (3.1415926 * r * r * h);
}
}
public class Test {
public static void main(String args[])
{
Column c = new Column(3,3,2.0,5.5);
System.out.println("X = "+c.get_x());
System.out.println("Y = "
相关问答:
当知道一个日期,如何把这个日期所在旬的前后两个日期取出
比如输入20090905,就输入20090901 20090910
输出20090901 20090910
取得天数后作一下判断再把这个方法用下void set(int field, int value)
......
请我用FCK上传文件,在本地的windows机上测试可以,但部署到linux服务器上就上传不了文件,上传文件时一直卡在那里。望各位大虾指点,谢谢!
路过,帮你顶一下。。。。。。。。。。。。。。
上传文件的路径问题, ......
java swing 程序如何打包成jar,然后可以通过批处理文件bat直接运行,有没有什么工具直接可以完成这两个工作?
用jar打包,把运行需要的jar拷贝到一个目录,批处理用 start javaw -cp .;其他包路径 运行
用zip ......
如: @superwaring("unchecked");
这个里面都可以取哪些值啊,还有类似的 @superwaring标签有哪些啊
没用过。。
看jee的api
javax.persistence里
@superwaring("unchecked");只是忽略 ......
大家好,我现在有一个用asp写的聊天室,现在的想添加一个功能,就是当有人上线的时候,发出提示,比如声音响一下,现在想用java实现这个功能,请问大家怎么实现?
谢谢了,我会加分的
asp和java整合到一起去?何必 ......