This basic java example source code reads radius of a circle from console input and then calculate the area and perimeter.

Circle Calculate Area and Perimeter Source Code



 * This basic java example source code
 * reads radius of circle from console input
 * Java Program to calculate the area and perimeter of Circle

public class CircleCalculation {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// Declare the reader from console
		BufferedReader br;
		// Get the console input for the rectangle dimension
		System.out.println("Enter the radius of the Circle");
		br = new BufferedReader(new InputStreamReader(;
		// assign to double variable the radius console input
		double radius = Double.parseDouble(br.readLine());
		// calculate the area of circle
		double area = Math.PI * Math.pow(radius, 2) ;
		// calculate the perimeter of circle
		double perimeter = 2 * Math.PI * radius;
		System.out.println("Area is "+ area);
		System.out.println("Perimeter is "+perimeter);



Sample Output

Enter the radius of the Circle
Area is 30.190705400997917
Perimeter is 19.477874452256717

Suggested Reading List