Categories
Uncategorized

Inner class (CIA 1B)

class rectangle

{

static double length,breadth;

rectangle()

{

length=4;

breadth=5;

}

public static void display()

{

double ar;

ar=length*length;

System.out.println(“area of square:”+ar);

}

          class square

              {

              void disp()

              {

             double ar;

             ar=length*breadth;

             System.out.println(“area of Rectangle:”+ar);

            }

           }


}

class area

{

public static void main(String args[])

{

rectangle r=new rectangle();

rectangle.square p=r.new square();

rectangle.display();

p.disp();

}

}