Variables which are declared within a method have
a scope local to that method.<br><br>If you want
variables accessable from method to method, you need to
declare them in the class.<br><br>For
example:<br><br>public class myClass{<br>private int
firstVariable;<br><br><br>public method1(){<br> firstVariable = 10;<br>
System.out.println("FirstVariable: =" + firstVariable);<br>}<br><br>public
method2(){<br> int localVariable = firstVariable;<br>
firstVariable = firstVariable + localVariable;<br>
System.out.println("FirstVariable has Changed: + firstVariable);<br>
System.out.println("LocalVariable now equals : " +
localVariable);<br>}<br><br>}<br><br>While one can do this, it is not a very
good
programming practice. variables which you want to share
access to should be passed into a method and returned if
they need to be changed outside the scope of that
method.<br><br>If you are changing too many "instance" variables,
it's time to look at your design. Doing this causes A
LOT of problems in maintance.