编写一个程序,计算箱子的体积,将每个箱子的高度、宽度和长度参数的值传递给构造方法,计算并显示体积
public class Box {
private double width=4;
private double length=5;
private double helight=6;
public Box() {}
public Box(double width,double length,double helight) {
this.width=width;
this.length=length;
this.helight=helight;
}
public double Volume() {
return width*length*helight;
}
public static void main(String[] args) {
Box b =new Box();
System.out.println(b.Volume());
}
}