Some constants of StrictMath class in Java

Some of the constants of StrictMath class.

1. StrictMath.E

Syntax:

double java.lang.StrictMath.E: 2.718281828459045

The double value that is closer than any other to e, the base of the natural logarithms.

Approach

Java

public class StrictMathE {
    public static void main(String[] args) {

        System.out.println(StrictMath.E);
    }
}

Output:

2.718281828459045


2. StrictMath.PI

Syntax:

double java.lang.StrictMath.PI: 3.141592653589793

The double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.

Approach

Java

public class StrictMathPI {
    public static void main(String[] args) {

        System.out.println(StrictMath.PI);
    }
}

Output:

3.141592653589793


No comments:

Post a Comment