문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top