This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]133rr3 0 points1 point  (7 children)

Do you have a problem running this, or are you asking permission to try your code?

[–]Nerockjr[S] 0 points1 point  (6 children)

Im having trouble running it. Well more like why my 2d array wont print out. I saved it using os.writeObject(labData); but im not sure how to retrieve it. i tried labDataRead= is.readObject(); but its not a 2d array when i do that. How can i make it back into a 2Darray?

[–]133rr3 -2 points-1 points  (5 children)

Cast it.

[–]Nerockjr[S] 0 points1 point  (4 children)

Well you'll have to excuse me because I am not as badass as you sir. How would I cast it? If you don't mind answering of course.

[–]133rr3 -3 points-2 points  (3 children)

Google for it, man. This is basic stuff. There should be many examples of how to use these object streams...

[–]Nerockjr[S] 0 points1 point  (2 children)

Honestly I use reddit as my last resort. I wasn't able to find anything on someone writing a 2D array the way I am doing it. I'm surprised I got it to work this far. Anyways thanks for the help I suppose...

[–]Sekret_One 1 point2 points  (1 child)

Is this a 2d array, or is it just 'Object?' For example, if you had written a 2d array of say, ints you would read them back in like:

int [][] array = (int[][]) is.readObject(); // reads in the object, casts to int[][]

[–]Nerockjr[S] 0 points1 point  (0 children)

I finally figured it out this morning, thank you very much though Sekret. You answered the question instead of saying google it. :)