Skip to Content

Find exponential value of a number using Math.exp

  1. /*
  2.   Find exponential value of a number using Math.exp
  3.   This java example shows how to find an exponential value of a number
  4.   using exp method of Java Math class.
  5. */
  6.  
  7. public class FindExponentialNumberExample {
  8.  
  9.   public static void main(String[] args) {
  10.    
  11.     /*
  12.      * To find exponential value of a number, use
  13.      * static double exp(double d) method of Java Math class.
  14.      *
  15.      * It returns e raised to argument value.
  16.      */
  17.    
  18.      System.out.println("Exponential of 2 is : " + Math.exp(2));
  19.   }
  20. }
  21.  
  22. /*
  23. Output would be
  24. Exponential of 2 is : 7.38905609893065
  25. */