CLASSES, OBJECTS AND METHODS


SOURCE CODE:
class Area
{
     int l,b;
    Area(int x,int y)
    {
       l=x;
       b= y;
    }
    int Result()
    {
       return l*b;
    }
}  

class Rectangle
{
   public static void main(String args[])
   {
      Area A=new Area(10,5);
      System.out.println("The Area of the Rectangle is : \t"+ A.Result());
   }
}

OUTPUT :

   The Area of the Rectangle is :       50
Previous
Next Post »

Still not found what you are looking for? Try again here.