Hey guys!! Welcome to flower brackets. Today we are going to learn java program to calculate area of a circle.

#### Java program to calculate area of a circle

Area of circle java is one of the common interview question. Here we are using scanner class to take input from user

Also Read – circumference of a circle in java

In the below java program user enters radius as input. Then use area of circle formula. Here’s the code and output of java program,

// area = pi * r * r where r is the radius of a circle

import java.util.Scanner; public class AreaOfCircleDemo { public static void main(String[] args) { int radius; double pi = 3.14, area; Scanner sc = new Scanner(System.in); System.out.print("Please enter radius of circle : "); radius = sc.nextInt(); area = pi * radius * radius; System.out.println("Area of circle : " + area); sc.close(); } }

**Output:**

Please enter radius of circle : 5

Area of circle : 78.5