Two Classes

No Comment - Post a comment

/* Simple Java Program For Claculating Area Of A Rectangle Using two Classes */

class TwoClasses
{
float length, breadth;

void getdata(float a, float b)
{
length = a;
breadth = b;
}
}

class Area
{
public static void main(String args[])
{
float area;
TwoClasses Rectangle = new TwoClasses(); // Object Reactangle
Rectangle.getdata(25,35);
area = Rectangle.length * Rectangle.breadth;
System.out.println("Area : "+area);
}
}

/* Output *
*Area : 875
*/

 
This Post has No Comment Add your own!

Post a Comment