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 »

If you still didn't find what you're looking for, you can search this website below: