-
Using an array from one class in another??
hi,
I need to make a Video store management system and am having some troubles. I need a class called TitleList that has an array that contains information about films titles. This will include film name, actors, director and code.
I also need to create a class called VideoList with an array containing information about videos. This will include information such as reference number and information extended from Title (actors, director etc).
When making the interface I need to be able to search the Title array to get a Title and the use this information to create a new Video to add to the Video array.
So, my question is how can I get information from the Title array from within the VideoList class???
I hope it makes sense and I really appreciate any help.
thanks
-
it sounds like you will be implementing an array(?) or arraylist(?) of Title objects. Search your array/list for the Title object you're looking for, then extract the needed information to populate fields in your Video object.
-
 Originally Posted by nspils
it sounds like you will be implementing an array(?) or arraylist(?) of Title objects. Search your array/list for the Title object you're looking for, then extract the needed information to populate fields in your Video object.
I think I've got it sorted, thanks for your help. I now have another problem. I will have one class that calls methods from other classes. The problem I have is exiting one of the methods. I was using System.exit(0) which seems to close all the running methods, not just the one that called it (if that makes sense). Is there a method that will stop just the one method.
Thanks
-
System.exit(0) calls Runtime.runtime.exit() which shuts down the java virtual machine. That is why all execution terminates.
What are you trying to accomplish? Catch an exception? Break out of a loop? Returning from a method? Better determine why you might be looking to exit() and then design a more appropriate environment in which to expect that event.
-
I have a some options for the user (edit borrowers, edit titles, edit videos).
If the user chooses edit borrowers they will be presented with another set of options (add borrower, remove borrower, display all borrowers and exit).
When the user chooses exit I want it to exit the edit borrowers method and return to the orignial method that will allow the user to select between the original options (edit borrowers, edit titles, edit videos).
It will be similar for edit titles and edit videos.
The problem I have is that my exit method uses system.exit(0) which shuts down the entire running application.
-
Then what you need to do is write your various methods so that if "exit" is chosen you return to your "main menu" method.
-
Thanks, I've sorted it now. I changed from using if and else statements to using a switch statement. This tidied my code up allowing me to spot a slight mistake in my while loop. I fixed it and it now exits when it's supposed to.
Thanks for your help
Similar Threads
-
Replies: 5
Last Post: 11-04-2005, 02:53 PM
-
Replies: 2
Last Post: 09-26-2005, 05:39 AM
-
Replies: 2
Last Post: 09-21-2005, 08:49 AM
-
Replies: 5
Last Post: 10-17-2002, 01:58 PM
-
Replies: 1
Last Post: 05-23-2002, 07:50 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks