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

Recommended Answers

All 4 Replies

What's wrong with the answer I gave you when you asked this in your other thread a few minutes ago?

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

then what are you trying to do ??? pls. be specific

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

Be a part of the DaniWeb community

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