21 lines
557 B
Java
21 lines
557 B
Java
import java.util.Scanner;
|
|
|
|
public class RectangleArea {
|
|
public RectangleArea() {}
|
|
|
|
public void display() {
|
|
Scanner scanner = new Scanner(System.in);
|
|
System.out.print("Length of the rectangle:");
|
|
int length = scanner.nextInt();
|
|
System.out.print("Width of the rectangle:");
|
|
int width = scanner.nextInt();
|
|
|
|
System.out.printf("The area of the rectangle is: %d", length*width);
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
RectangleArea r = new RectangleArea();
|
|
r.display();
|
|
}
|
|
}
|