Java Data Type Tutorial - Java Math.exp(double a)








Syntax

Math.exp(double a) has the following syntax.

public static double exp(double a)

Example

In the following code shows how to use Math.exp(double a) method.

//from www .j a  v  a 2s  .co  m
public class Main {

   public static void main(String[] args) {

      double x = 5;
      double y = 0.5;

      // print e raised at x and y
      System.out.println("Math.exp(" + x + ")=" + Math.exp(x));
      System.out.println("Math.exp(" + y + ")=" + Math.exp(y));


   }
}

The code above generates the following result.