Monday, June 30, 2008


How to Calculate Area of Rectangle?

This example explain you how to calculate area of a rectangle using java code. For calculating area of rectangle, we need three variables. One for length, one for breadth and one variable calculate the area of rectangle. We have already read and know how to calculate area of rectangle using formula a=lXb. Here is the source code to find the area of rectangle :

class Rectangleexample
{
public static void main(String[] args)
{
int len=5, breadth=7, area=1;
area = len*breadth;
System.out.println("Area if Rectangle :" + area);
}
}


0 comments: