Results 1 to 2 of 2
- 11-06-2012, 07:29 PM #1
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
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
)
- 11-06-2012, 08:25 PM #2
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
Similar Threads
-
Calling variables from another method
By jwl in forum New To JavaReplies: 2Last Post: 10-17-2012, 08:37 PM -
Calling variables from another method
By jwl in forum Advanced JavaReplies: 1Last Post: 10-16-2012, 04:45 AM -
Final variables in method
By noobplus in forum New To JavaReplies: 2Last Post: 03-04-2012, 03:32 PM -
How to change variables from a method in a different class
By tomasmk in forum New To JavaReplies: 8Last Post: 10-24-2011, 10:34 PM -
accessing variables in a method that returns a void
By mochajava in forum New To JavaReplies: 2Last Post: 02-12-2011, 08:00 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks