java cmd 运行问题,非法的表达式开始怎么解决???
这是我的Java程序,弄了半天不知道哪儿出问题了,请大家帮帮忙,在线等急,非常感谢!!!publicclassCircimplementsCalculate,Geomet...
这是我的Java程序,弄了半天不知道哪儿出问题了,请大家帮帮忙,在线等急,非常感谢!!!
public class Circ implements Calculate,GeometryShape{
{
{
public float getArea(float r);
float area=Calculate.PI*r*r;
return area;
}
public float getCircumference(float r){
float circumference=2*Calculate.PI*r;
return circumference;
}
public void draw(){
System.out.println("画一个圆形!");
}
}
public static void main(String[] args){
Circ circ=new Circ();
float r=7;
float area=circ.getArea(r);
System.out.println("圆的面积为:"+area);
float circumference=circ.getCircumference(r);
System.out.println("圆的周长为:"+circumference);
circ.draw();
}
} 展开
public class Circ implements Calculate,GeometryShape{
{
{
public float getArea(float r);
float area=Calculate.PI*r*r;
return area;
}
public float getCircumference(float r){
float circumference=2*Calculate.PI*r;
return circumference;
}
public void draw(){
System.out.println("画一个圆形!");
}
}
public static void main(String[] args){
Circ circ=new Circ();
float r=7;
float area=circ.getArea(r);
System.out.println("圆的面积为:"+area);
float circumference=circ.getCircumference(r);
System.out.println("圆的周长为:"+circumference);
circ.draw();
}
} 展开
6个回答
展开全部
public class Circ implements Calculate,GeometryShape {
public float getArea(float r){ //这里写错了!
float area=Calculate.PI*r*r;
return area;
}
public float getCircumference(float r){
float circumference=2*Calculate.PI*r;
return circumference;
}
public void draw(){
System.out.println("画一个圆形!");
}
public static void main(String[] args){
Circ circ=new Circ();
float r=7;
float area=circ.getArea(r);
System.out.println("圆的面积为:"+area);
float circumference=circ.getCircumference(r);
System.out.println("圆的周长为:"+circumference);
circ.draw();
}
}
追答
还有括号的问题,我最后更新你可能没有看到,再贴一次
public class Circ implements Calculate,GeometryShape {
public float getArea(float r){
float area=Calculate.PI*r*r;
return area;
}
public float getCircumference(float r){
float circumference=2*Calculate.PI*r;
return circumference;
}
public void draw(){
System.out.println("画一个圆形!");
}
public static void main(String[] args){
Circ circ=new Circ();
float r=7;
float area=circ.getArea(r);
System.out.println("圆的面积为:"+area);
float circumference=circ.getCircumference(r);
System.out.println("圆的周长为:"+circumference);
circ.draw();
}
}
展开全部
你还真敢写啊
public class Circ implements Calculate,GeometryShape{
public float getArea(float r){
float area=Calculate.PI*r*r;
return area;
}
public float getCircumference(float r){
float circumference=2*Calculate.PI*r;
return circumference;
}
public void draw(){
System.out.println("画一个圆形!");
}
public static void main(String[] args){
Circ circ=new Circ();
float r=7;
float area=circ.getArea(r);
System.out.println("圆的面积为:"+area);
float circumference=circ.getCircumference(r);
System.out.println("圆的周长为:"+circumference);
circ.draw();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class Circ implements Calculate,GeometryShape{
{
public float getArea(float r){
float area=Calculate.PI*r*r;
return area;
}
public float getCircumference(float r){
float circumference=2*Calculate.PI*r;
return circumference;
}
public void draw(){
System.out.println("画一个圆形!");
}
}
public static void main(String[] args){
Circ circ=new Circ();
float r=7;
float area=circ.getArea(r);
System.out.println("圆的面积为:"+area);
float circumference=circ.getCircumference(r);
System.out.println("圆的周长为:"+circumference);
circ.draw();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
方法声明后应该是方法体的{}没有分号的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询