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:
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