What are exponents in Java?


Quick Answer

Exponents in Java are handled using the exp() function, which is a method of the Math class. The expression Math.exp(x) gives the fundamental constant e, which is roughly equal to 2.72, raised to the power x.

Continue Reading

Full Answer

Instead of writing Math.exp(x), the programmer can import the entire Math class by including the command "import static java.lang.Math.*;" at the beginning of the program or class file. Once the Math class has been imported, the programmer can simply write exp(x) to give e raised to the power of x. Both x and the result of the expression exp(x) are variables of type double.

Learn more about Internet & Networking

Related Questions