class Box
{
static double width;
static double height;
static double depth;
public static void main(String ar[])
{
Box b1 = new Box();
Box b2 = new Box();
double vol;
b1.width = 10;
b1.height = 20;
b1.depth = 15;
b1.width = 3;
b1.height = 6;
b1.depth = 9;
vol = b1.width*b1.height*b1.depth;
System.out.println("Volume is "+vol);
vol = b2.width*b2.height*b2.depth;
System.out.println("Volume is "+vol);
}
}
OUTPUT
Comments
Post a Comment