Saturday, April 30, 2016

First Post

class Box
{
private double length;
private double width;
private double height;
Box(double l, double w, double h)
{
length=l;
width=w;
height=h;
System.out.println(“Creating or Using Construct”);
}
double calcVolume()
{
return length*height*width;
}
}
class BoxVolume
{
public static void main(String[] args)
{
Box b1 =new Box(2,3,4.4);
double v1;
v1=b1.calcVolume();
System.out.println(“Box b1’s volume=”+v1);
}
}

No comments:

Post a Comment