This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Passing Jave object arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Passing Jave object arrays" Watch "Passing Jave object arrays" New topic

Passing Jave object arrays

Alexander Berry

Joined: Jan 17, 2010
Posts: 7

I have a little bit of code here and what it is attempting to do is read a file into a arraylist then return the array object to another method/Class for testing I am just using a method later it will e a class.

I can get the createObj code to work and but I have loss may way attempting to figure out how to get the readObj method to take the class and use the array.

The code is below any help would be greatly appreciated.



David Newton

Joined: Sep 29, 2008
Posts: 12617

Your method that reads should return a list, and the other method should take one. A list is an object, but an object isn't (necessarily) a list.
Alexander Berry

Joined: Jan 17, 2010
Posts: 7
I can't seem to get the arraylist method signature correct in readObj and I am not sure I have it correct in the return.

This is what I have so far:

Alexander Berry

Joined: Jan 17, 2010
Posts: 7
I have it working between the two method now.

OK, OK, OK, I forgot the basics.

My next task is to get it working between classes via return. Until then I will consider this close I will repost if I have a problem.

Thanks for your help: Below is the code.

I agree. Here's the link:
subject: Passing Jave object arrays
Similar Threads
File Operations Program Problem
Error while trying to add an object to array list
Using Scanner need help comparing two files so I can write out data I need.
Parsing a text file to an arraylist