class Rectangle
{
                int length,width;
                Rectangle(int x,int y)
                {
                                length=x;
                                width=y;
                }
                int rectArea()
                {
                                return(length*width);
                }
}
class RectangleArea
{
                public static void main(String args[])
                {
                                Rectangle rect=new Rectangle(10,20);
                                int area=rect.rectArea();
                                System.out.println("Area = "+area);
                }
}

JAVA 17.PNG

Advertisements