Perimeter of circle=pi * radius * radius
Enter the radius of the circle as input. Now we use the given formula to calculate the area of the circle using formula.
Here is the source code of the Java Program to Calculate and Display Area of a Circle. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.
public class Area
public static void main(String args)
double pi = 3.14, area;
Scanner s = new Scanner(System.in);
System.out.print("Enter radius of circle:");
r = s.nextInt();
area = pi * r * r;
System.out.println("Area of circle:"+area);
$ javac Area.java $ java Area Enter radius of circle:5 Area of circle:78.5
Sanfoundry Global Education & Learning Series – 1000 Java Programs.