How can I use variables from one method in another?
I am making a theatre bookings system, for each row in the theatre I made an array of seats. This was done in one method (I refer to it as the array method).
I am now making an interface which will allow the user to check the total seats in the theatre, however, as I have made another method for the interface (to make it far easier to read), I don't know how I can transfer the value of ARRAYNAME.length to this other method for printing.
I cannot make a variable called totalSeats in the array method and reference it in the userInterface method as the computer would be looking for a variable named totalSeats in the interface method.
I also cannot make a totalSeats variable in the userInterface method and reference the arrays in the array method as once again, the current method would only be looked at.
How can I get around this (preferably without having to re-write my entire program :(doh):)
Re: How can I use variables from one method in another?
ah, doesn't matter, I've found it.
I just need to declare it outside of any method.