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);

Recommended Answers

All 5 Replies

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.

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'

It's now line 13

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.