PROGRAM TO FIND AREA OF RECTANGLE USING OBJECTS

//PROGRAM TO FIND AREA OF RECTANGLE USING OBJECTS
class Rectangle1
{
int l,b,ar;
int area( )
{
return(ar=l*b);
}
}
class Rect
{
public static void main(String args[ ])
{
int c;
Rectangle1 r1=new Rectangle1( );
r1.l=5;
r1.b=10;
c=r1.area( );
System.out.println(“Length of rectangle is = 5″);
System.out.println(“Breadth of rectangle is = 10″);
System.out.println(“Area of rectangle is = “+c);
}

}

Leave a Reply

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