Question:

Java exponents. Why can't i put this to the power of something?

by  |  earlier

0 LIKES UnLike

How can I square the value in the parentheses in Java?

(x1-x2)

 Tags:

   Report

2 ANSWERS


  1. Well ... use the 'pow' function ...


  2. Use pow() method in Math class. The syntax is Math.pow(double a, double b); Need to cast the numbers to double type.

    double result = Math.pow ((double)(x1-x2), (double)2);

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions