PROGRAM TO FIND THE VOLUME OF A BOX USING OBJECTS

//PROGRAM TO FIND THE VOLUME OF A BOX USING OBJECTS
class Box
{
int l,b,h;
int volume( )
{
return(l*b*h);
}
}
class Abc
{
public static void main(String args[ ])
{
Box b1= new Box( );
b1.l=4;
b1.b=6;
b1.h=10;
System.out.println(“Length of box is = 4″);
System.out.println(“Breadth of box is = 6″);
System.out.println(“Height of box is = 10″);
System.out.println(“Volume of box is =”+b1.volume( ));
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *