Calculate Circle Perimeter using Java Example

 
Perimeter of a circle = 2 * pi * r.
where:
r is the radius of the circle.
pi is a mathematical constant.

Program to Calculate Circle Perimeter using Java.

/**
 * Program to Calculate Circle Perimeter using Java Example.
 * @author javawithease
 */
public class CirlePerimeterExample {
	static void circlePerimeter(int radius){
		 //Calculate Circle Perimeter.
		 double perimeter = 2 * Math.PI * radius;
                 //Print Circle Area.
                 System.out.println("Circle perimeter: " + perimeter);
	}	
 
	public static void main(String args[]){ 
		//method call 
		circlePerimeter(20); 
	}
}

Output:

Circle perimeter: 125.66370614359172

Download this example.