## What is “pi” (π) in mathematics?

*“The ratio of a circle’s circumference to its diameter i-e; 22/7 is represented by a constant value of 3.14159 is called “pi” in mathematics.”*

## What is Math.PI in Java?

*“Math.PI is a static final double constant in Java, equivalent to in π Mathematics.”*

- Aerospace designers use pi to compute the area of the body of the aircraft.
- Medical Science benefits from pi by using it to analyze the structure of the eye.
- Biochemists use pi to study the composition of DNA.
- Statisticians use pi to project the population dynamics of the state.
- Pi has a core value in the current Global Positioning System (GPS) we have today.

### Example

If you want to learn how to get and how to use the value of Math.PI in Java let’s have a look at the following executable example.```
public class PiInJava {
public static double circumferenceOfCircle(int radius) {
return Math.PI * (2 * radius);
}
public static double areaOfCircle(int radius) {
return Math.PI * Math.pow(radius, 2);
}
public static double volumeOfSphere(int radius) {
return (4 / 3) * Math.PI * Math.pow(radius, 3);
}
public static double surfaceAreaOfSphere(int radius) {
return 4 * Math.PI * Math.pow(radius, 2);
}
public static void main(String[] args) {
int radius = 5;
System.out.println("Circumference of the Circle = " + circumferenceOfCircle(radius));
System.out.println("Area of the Circle = " + areaOfCircle(radius));
System.out.println("Volume of the Sphere = " + volumeOfSphere(radius));
System.out.println("Surface Area of the Sphere = " + surfaceAreaOfSphere(radius));
}
}
```

### Output

Circumference of the Circle = 31.41592653589793
Area of the Circle = 78.53981633974483
Volume of the Sphere = 392.6990816987241
Surface Area of the Sphere = 314.1592653589793

GO TO FULL VERSION