Java Tutorial Java Advanced Java References

Java Math - E Field



The Java E field is used to return the value of e to the available precision. It returns the value of e as 2.718281828459045.

Syntax

public const double E = 2.718281828459045;

Parameters

No parameter is required.

Return Value

Returns the value of e to the available precision.

Example:

In the example below, Math.E constant is used to return the value of e to the available precision.

public class MyClass {
  public static void main(String[] args) {
    double const_e = Math.E;
    System.out.println("Math.E = " + const_e);   
    System.out.println("Math.log(Math.E) = " + Math.log(const_e));
    System.out.println("Math.log10(Math.E) = " + Math.log10(const_e));      
  }
}

The output of the above code will be:

Math.E = 2.718281828459045
Math.log(Math.E) = 1.0
Math.log10(Math.E) = 0.4342944819032518

❮ Java Math Methods