I know that in VB, the operator to illustrate exponents is a hat (^). How can I write this exponent operator in java?
Thanks a bunch!
Printable View
I know that in VB, the operator to illustrate exponents is a hat (^). How can I write this exponent operator in java?
Thanks a bunch!
Search in the Math librairy.
The Math class holds the answers you seek.
The Math class is cool! ;)
2 ^ 3 = 8
yeah, there is no explicit operator for exponents in java :(Code:double cubed = java.lang.Math.pow ( 2, 3);
and you don't need to type the whole java.lang.Math.pow
as the java.lang package is imported by default, i jsut wanted to show you the whole path to the class so you didn't confuse it w/ java.math.*.