Area of a circle = pi * r * r.
where:
r is the radius of the circle.
pi is a mathematical constant.
/**
* Program to Calculate Circle Area using Java Example.
* @author javawithease
*/
public class CirleAreaExample {
static void circleArea(int radius){
double area = Math.PI * radius * radius;
//Print Circle Area.
System.out.println("Circle area: " + area);
}
public static void main(String args[]){
//method call
circleArea(20);
}
}
Circle area: 1256.6370614359173
About the author