java程序错误找不出来,帮忙啊大家

来源:百度知道 编辑:UC知道 时间:2024/05/22 04:50:27
package maths;
public class Box{
private double length;
private double width;
private double height;
public Box(){
length=0;
width=0;
height=0;
public void setLength(double length)
{this.length=length;}
public double getLength()
{return length;}
public void setWidth(double width)
{this.width=width;}
public double getWidth()
{return width;}
public void setHeight(double height)
{this.height=height;}
public double getHeight()
{return height;}
public double volume(){
double volumnValue=0;
volumnValue=length*width*height;
return volumnValue;}
public double surfaceArea(){
double surfaceAreaValue=0;
surfaceArea Value=2*length*width+2*length*height+2*width*height;
return surfaceAreaValue;}

改了一下,错误注在程序中了
package maths;

public class Box{
private double length;
private double width;
private double height;
public Box(){
length=0;
width=0;
height=0;
}//这里少了一个花括号

public void setLength(double length)
{this.length=length;}
public double getLength()
{return length;}
public void setWidth(double width)
{this.width=width;}
public double getWidth()
{return width;}
public void setHeight(double height)
{this.height=height;}
public double getHeight()
{return height;}
public double volume(){
double volumnValue=0;
volumnValue=length*width*height;
return volumnValue;}
public double surfaceArea(){
double surfaceAreaValue=0;
surfaceAreaValue=2*length*width+2*length*height+2*width*height;//这里多了一个空格
return surfaceAreaValue;
}
}//最后少了一个花括号