Run ❯
Get your
own Java
server
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
public class Main { public static void main(String[] args) { // Create integer variables int length = 4; int width = 6; int area; // Calculate the area of a rectangle area = length * width; // Print variables System.out.println("Length is: " + length); System.out.println("Width is: " + width); System.out.println("Area of the rectangle is: " + area); } }
Length is: 4
Width is: 6
Area of the rectangle is: 24