cannot find symbol - method error

The line below comes up with an error saying "cannot find symbol - method numCols".

if ((this.numCols() != rightHandSide.numCols()) || (this.numRows() != rightHandSide.numRows())){

But this method is in the code

publicint numCols()

{

return this.myCells[0].length;

}

Any help would be appreciated. Thanks.

[567 byte] By [poseidona] at [2007-10-2 12:04:18]
# 1
Probably the variable is out of scope. Try a more global location for the definition.
ChuckBinga at 2007-7-13 8:27:32 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
What is rightHandSide? Is it the same class? If it isn't, the message might be referring to rightHandeSide.numCols() not this.numCols().
Gita_Weinera at 2007-7-13 8:27:32 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

> The line below comes up with an error saying "cannot

> find symbol - method numCols".

>

> if ((this.numCols() !=

> rightHandSide.numCols()) || (this.numRows() !=

> rightHandSide.numRows())) {

> But this method is in the code

>

> public int numCols()

>{

> return this.myCells[0].length;

>}

>

> Any help would be appreciated. Thanks.

It's simply that numCols() method is not a member of rightHandSide. To make it work, you should make sure that rightHandSide is an instance of the class in which numCols() is defined.

beckham12a18a at 2007-7-13 8:27:32 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...