# Java program to calculate area of a circle

Let’s learn java program to calculate area of a circle.

## Java program to calculate area of a circle

Java program to find area of circle and rectangle is one of the common java interview question.

In the below java program to find area of circle first user enters radius as input using nextDouble() method of Scanner class.

Also read – java program to calculate area of rectangle

This input is stored in double data type variable ‘radius’.

Also read – circumference of circle in java

Then using area of circle formula area is calculated. Here’s the formula to find area of circle,

area = pi * r * r

where r is the radius of a circle

Here’s the simple java program to find area of circle.

```import java.util.Scanner;
public class CalculateAreaOfCircle
{
public static void main(String[] args)
{
double pi = 3.1415, area;
Scanner sc = new Scanner(System.in);
System.out.println("Area of circle: " + area);
sc.close();
}
}

```

Output:
Area of circle : 78.53750000000001

Java program to find area of circle using class and object

We can also find area of circle using class and object.

To calculate area and circumference of circle using given radius first create class Circle, variable/field radius methods findArea(), findCircumference() and setValues().

Here’s the java program to find area of circle using class and object.

```class Circle
{
{
}
void findArea()
{
System.out.println("Area of circle = " + circleArea);
}
void findCircumference()
{
double circleCircumference = 2 * Math.PI * radius ;
System.out.println("Circumference of circle = " + circleCircumference);
}
public static void main(String[] args)
{
Circle obj = new Circle();
obj.setValues(5);
obj.findArea();
obj.findCircumference();
}
}

```

Output:

Area of circle = 78.53981633974483
Circumference of circle = 31.41592653589793

Similarly here’s the java program to find area of circle using method – area of circle in java using method.

Java program to find area of circle using bufferedreader

```import java.io.BufferedReader;
import java.io.IOException;
{
public static void main(String[] args) throws NumberFormatException, IOException
{
System.out.println("Area of circle using bufferedreader: " + area);
}
}

```

Output: