Frage

As above, I'm trying to make a number to the power of a variable, but it's not working, and is producing the error "The operator ^ is undefined for the argument type(s) double, long".

Here's the line of code:

longSwordCost = 30*(1.3^longSwordCount);

Help!

War es hilfreich?

Lösung

You need public static double Math.pow(double a, double b):

http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#pow%28double,%20double%29

The ^ is an XOR logic operator in Java.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top