Calculate Rectangle Area using Java Example

 
Area of a rectangle = length * width.

Program to Calculate Rectangle Area using Java.

/**
 * Program to Calculate Rectangle Area using Java Example.
 * @author W3schools360
 */
public class RectangleAreaExample {
	static void rectangleArea(int length, int width){
                 //Calculate Rectangle Area.
		 int area = length * width;
                 //Print Rectangle Area.
                 System.out.println("Rectangle area: " + area);
	}	
	
	public static void main(String args[]){ 
		//method call 
		rectangleArea(20, 30); 
	}
}

Output:

Rectangle area: 600