Hi, i'm learning java and I don't know why I'm getting this error.
New Error on line 11 - "Cannot find symbol"

int first, second;
        int first, second;
        double firstcube, secondcube, power = 3, num = 3, pow;

        Scanner scan = new Scanner(System.in);

        System.out.println("Enter First Number: ");
        first = scan.nextInt();
        
        System.out.println("Enter Second number: ");
        second = scan.nextInt();

        firstcube = pow (num, power);

Edited 7 Years Ago by anevins: new code

I think it sees this:

firstcube = static double pow(double first, double 3);

and expects you to be declaring a static object of type double, so it expects a name but instead gets a call to pow(...).


Are you trying to cast the results as a double? pow(...) should already be returning a double.

Edited 7 Years Ago by donaldw: n/a

The problem is with this line firstcube = static double pow(double first, double 3); which is invalid. When invoking methods, you don't need to specify the method modifiers along with their parameter types. I'd recommend reading the Java tutorial on Sun or the sticky at the top of this forum to get started with Java.

The problem is with this line firstcube = static double pow(double first, double 3); which is invalid. When invoking methods, you don't need to specify the method modifiers along with their parameter types. I'd recommend reading the Java tutorial on Sun or the sticky at the top of this forum to get started with Java.

I've replaced the code with

firstcube = pow (num, power);

there's an error 'cannot find symbol'

Do you need to include any type of math libraries, perhaps, to let the compiler know what "pow" is?

This article has been dead for over six months. Start a new discussion instead.