Area Of Circle Example Java Program


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


The area of a circle is written

r = Radius
? = ~3.14

Area Of Circle Example Program

import java.util.Scanner;

class AreaOfCircle{
	Scanner in = new Scanner(;
	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