Post removed
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Post removed
Last edited by Jack Hammered; January 4th, 2012 at 08:25 PM.
You can use an assignment statement to put an object into an array. Given an array: anArray, anObject and an index: theIndextrying to import a sinlge object, MM, imto an array of these objects
anArray[theIndex] = anObject; // put anObject into the array at theIndex slot
Can you explain your problem? Do you get errors? If so please post them here.
Does the code execute?
If it does not do what you want it to do, please explain. What do you want it to do that is different from what it does.
Post removed
Last edited by Jack Hammered; January 4th, 2012 at 08:24 PM.
How does your posted code relate to your question?how to pass on the object from its class (movie) to the object array (movieList)
Your posted example does not have an array: movieList or a class movie. What is the name of the object that you want to pass.
movie() appears to be a method. The ending ()s says it is a method.
The only array name I see is MML which is defined in the MovieList class and used in method: importRecord(). Are these two different arrays in two different classes with the same name?
Note: Standard class names begin with uppercase.
You need to use correct terminology when talking about your code.
Thank you for your help: I guess me being new to Java I wouldn't know what I was doing. I thought I created an object of (movie) and I wanted to import that into a position within the movieList (MML) array. Sorry to have bothered you.
{ // --- Create an object --- MyObject obj = new MyObject(); // --- Use the object --- obj.printMyValues(); }
// --- Creating the object --- movie MM = new movie(); // --- Using the object MM.movie_title = movie_title; MM.movie_released = movie_released;
AFAIK
Last edited by Jack Hammered; January 4th, 2012 at 08:43 PM. Reason: IDK
It's important to get the vocabulary right and to use the correct spellings and names when describing a problem. Not many of us are mind readers. There are too many different ways to go wrong that a partial incorrect example makes it very hard to understand what you are trying to do.
Apparently there are too many problems with my code or with what I have said. I do not understand the terms or vocabulary very well: Neither I nor my code can express what I intended.
Movie - Java file
Movie - Class
//details of movie
Menu - Java file
Menu - Method
//create movie object of movie class (MM)
//assign values to movie object (MM)
MovieList - Java file
MovieList - Class
//point to object (MM)
//insert (MM) into array of said objects (MML)
I appreciate you having a look and telling me that I haven't done what I intended to do nor what I have done is correct. It seems I have not only wasted your time but mine as well.
Last edited by Jack Hammered; January 4th, 2012 at 09:55 PM.
Is this what you are asking about://insert (MM) into array of said objects (MML)
MML[indexOfNextEmptySlot] = MM; // insert/add object MM to the array MML
indexOfNextEmptySlot++; // move index to next slot
Please do not remove your posts like this. You have rendered this thread useless. Next time will be an infraction.
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
newbie (January 5th, 2012)