I am trying to use a simple println(...) statement to display the value of a variable from a separate class.

The two separate classes are linked.

AbacusModel class has an array 'peg_array' which stores the number of counters present in each of the elements of the array.

AbacusModel has a variable 'thisPeg' which is used to refer to any of the pegs in the array e.g. peg_array[thisPeg]

In the seperate class (AbacusPanel) i want to call the number of counters present in any particular element that the user clicks in. but it displays "error: cannot find symbol" which is due to it being an instance variable of the AbacusModel class. How can i print this value in the AbacusPanel class???

I am in need of help here as my java knowledge is very limited so any ideas would be a great help. Thanks :)

5 Years
Discussion Span
Last Post by l.worboyz

please show your code.Its will be much clear if you show code and then ask the question so that we can guide you in correct way and also we can know what exactly is the scope,life of that variable you are calling


sorry James Cherrill, did not see your response in the other thread...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.