Write a Java program to print the area and perimeter of a circle

This example will provide how to print the area and perimeter of a circle in Java.

package octopuscodes.com.demo;

import java.util.Scanner;

public class Demo {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		System.out.print("Radius: ");
		double radius = scanner.nextDouble();
		double area = Math.PI * radius * radius;
		double perimeter = 2 * Math.PI * radius;
		System.out.println("Area : " + area);
		System.out.println("Perimeter : " + perimeter);

	}

}
Radius: 4
Area : 50.26548245743669
Perimeter : 25.132741228718345