How to calculate area of rectangle in java?

This is one of the basic java program with usage of operators.To calculate area of rectangle we need formula to calculate area which is length*breadth.

Java Program to calculate area of rectangle:

public class AreaDemo {

	public static void main(String[] args) {

		int length=20;

		int breadth=30;

		int area=length*breadth;

		System.out.println("Area="+area);

	}

}

 Output :

Area=600

Leave a Reply

Your email address will not be published. Required fields are marked *