JavaHow To Get the Area of a Rectangle
Area of Rectangle
The area of a rectangle can be found by multiplying the length of the rectangle by the width:
Example
int length = 5; int width = 2; int area = length * width; System.out.println("Area of rectangle: " + area);Try it Yourself »Explanation: We store the rectangle's length and width in two variables.
Then we multiply them (length * width) to get the area.
Finally, we print the result, which in this example is10.

