Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Passing Jave object arrays" Watch "Passing Jave object arrays" New topic
Author

Passing Jave object arrays

Alexander Berry
Greenhorn

Joined: Jan 17, 2010
Posts: 7
Hello,

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.

Thanks,

Alex.


David Newton
Author
Rancher

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
Greenhorn

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
Greenhorn

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.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Passing Jave object arrays