Results 1 to 5 of 5

Thread: What is the Java exponent operator?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    2

    Question What is the Java exponent operator?

    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!

  2. #2
    Ya ya Baby!!!Me is Back
    Join Date
    Jul 2002
    Posts
    362
    Search in the Math librairy.

  3. #3
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    The Math class holds the answers you seek.

  4. #4
    Lively Member
    Join Date
    Oct 2001
    Posts
    122

    Wink

    The Math class is cool!

  5. #5
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332
    2 ^ 3 = 8

    Code:
    double cubed = java.lang.Math.pow ( 2, 3);
    yeah, there is no explicit operator for exponents in java

    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.*.
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width