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 = "
相关问答:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 52 in the jsp file: /vip_info.jsp
ÕË cannot be resolved
49: <table border="1& ......
我是个新手,望高手解答
我现在已经安装了mysql,也有mysql的jdbc。但我怎么配置后,才能在MyEclipse里操作mysql呢?请高手说详细点
打开Myeclipse----window---open perspective---MyEclipse database explorer-- ......
如: @superwaring("unchecked");
这个里面都可以取哪些值啊,还有类似的 @superwaring标签有哪些啊
没用过。。
看jee的api
javax.persistence里
@superwaring("unchecked");只是忽略 ......
insert into [ScholarshipManagement].[dbo].[department] ([department],[specialization] ,[grade]) output inserted.departmentID values(? ,? ,? )
请问大哥们这个sql 语句应该用Java里的那个数据库操作方法? ......
大家好,我现在有一个用asp写的聊天室,现在的想添加一个功能,就是当有人上线的时候,发出提示,比如声音响一下,现在想用java实现这个功能,请问大家怎么实现?
谢谢了,我会加分的
asp和java整合到一起去?何必 ......