Area Of Circle Example Java Program

Definition

The area of a circle is ? (Pi) times the Radius squared,which is written A=?r2.

Formula

The area of a circle is written
A=?r2

here,
r = Radius
? = ~3.14

Area Of Circle Example Program

import java.util.Scanner;

class AreaOfCircle{
	Scanner in = new Scanner(System.in);
	public static void main(String args[]){
		System.out.print("Enter the radius: ");
		double radius = in.nextDouble();
		double area = Math.PI * (radius * radius);
		System.out.println("The area of circle is: " + area);
	}
}

Sample Output

Output is:
Enter the radius: 4
The area of circle is: 50.26548245743669