Posts Tagged Math

Java – Math PI Example, Math PI Program

Sunday, November 8th, 2009

Math class is part of java.lang package. Math PI returns the pi value of 3.141592653589793

Math PI example how to use Math PI in java

public class MathPIExample {

    public static void main(String[] args) {

        double E=Math.PI;

        System.out.println("Math PI :"+E);
    }
}

Output

Math PI :3.141592653589793