bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java How To's
Java•Java How To's

Java How To Get the Area of a Rectangle

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java How To Get the Area of a Rectangle?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ length = 5;

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);

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 is 10 .

Previous

Java How To Find the Square Root of a Number

Next

Java How To - Convert Celsius to Fahrenheit