Cannot resolve symbol error with IntelliJ

Hi folks,

Itā€™s come to my attention that some learners have run into a small issue when building their own Java code as shown in the image below:

symbol_error

Notice how the code num: is red and returning an error 'Cannot resolve symbol ā€˜numā€™. This is because that num: code shouldnā€™t be there. All thatā€™s required to pass to the squareValue() method is the number 2.

So should I be adding it or not?

You may be asking ā€˜but I saw that code in the examples in the courseā€™. Which is a fair point to make. The reason you are seeing that num: in the lesson video is because itā€™s not actually Java code, but the IDE Intellij trying to help by showing you what the name of the parameter is that you just assigned the number to.

In a nutshell, when the method was declared it had a parameter that had the name num so when the method was called later with the number 2, IntelliJ is showing you that that number 2 is assigned to the parameter num.

I hope that clarifies that issue. If you have any more questions about this please feel free to ask.

- Mark

1 Like

Thanks. That fixed my issue!

Thanks Mark - wonder why Iā€™ve not had any notification of this post (via email), Iā€™d have been here sooner had I known! [Also been a helluva month hasnā€™t it?]