by Dinesh Thakur Category: Data Type

In the Following example PerimeterofCircleExample shows how to Calculate Perimeter of Circle using 2*pi*r. where r is a radius of a circle.


public class PerimeterofCircleExample { // Declaring class name as PerimeterofCircleExample
public static void main(String[] args) {
 int r = 0;  // r for radius of circle
System.out.print("Please enter the radius value r :");
//Obtaining the keyboard input with BufferedReader
BufferedReader Buffer= new BufferedReader(new InputStreamReader(;
 r = Integer.parseInt(Buffer.readLine());
/* Math.PI = 3.14 is Math constant to get value of pi
    Perform Calculations and Display Result
    calculate the perimeter of circle that is PerimeterofCircle = 2 *pi*r
double PerimeterofCircle = 2 * Math.PI * r;
System.out.println("The Perimeter of circle is " + PerimeterofCircle);
catch(Exception e)
                                 System.out.println("Input Error : "+e);                       

Perimeter of Circle Example

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.