# Java program to find Area of Rectangle

Area of Rectangle in Java - This program will read length and width of the Rectangle and Calculate Area of the Rectangle.

To find Area of the Rectangle - Multiply Rectangle Length with Rectangle Width.

## Area of Rectangle using Java program

```//Java program to find Area of Rectangle.

import java.util.*;

public class AreaRectangle{

public static void main(String []args){
double length,width,area;

Scanner sc=new Scanner(System.in);

//Read Length and Width of Rectangle
System.out.print("Enter length: ");
length=sc.nextDouble();
System.out.print("Enter width: ");
width=sc.nextDouble();

//Calculate Area
area= length*width;

//Print Result
System.out.println("Area of Rectangle: " + area);

}
}
```

Output

```    [email protected]:~\$ javac AreaRectangle.java
[email protected]:~\$ java AreaRectangle

Enter length: 10.2
Enter width: 20.3
Area of Rectangle: 207.06
```

### Using Function/Method

```//Java program to find Area of Rectangle.

import java.util.*;

public class AreaRectangle{

//Function to find Area of Rectangle
public static double AreaOfRectangle(double l, double w)
{
double area;
area=l*w;
return area;
}

public static void main(String []args){
double length,width,area;

Scanner sc=new Scanner(System.in);

//Read Length and Width of Rectangle
System.out.print("Enter length: ");
length=sc.nextDouble();
System.out.print("Enter width: ");
width=sc.nextDouble();

//Find Area - Calling Functionn
area= AreaOfRectangle(length, width);

//Print Result
System.out.println("Area of Rectangle: " + area);

}
}
```