Quote:do you want me to post the whole code?
No, because what you want to do isn't possible:
is a variable that is defined inside the method
. That is called a local variable
and it only exists in the scope of the method body.
Scope defines how "visible" an item is: it is limited to the enclosing set of curly brackets and cannot be used outside them unless it is declared public (or similar) and defined at class level.
In the case of local variables, it's even worse: the variable is created when the method is called, and destroyed when it returns - literally destroyed, the memory space that was allocated on the stack to hold it is released and becomes available for other functiosn to use!
The only way to preserve the value once the method exits is to either store it in a class level variable or return it from the method to the caller wirth a
statement - in which case the method must be declared to return teh appropriate value type, not