Arrays in Java - accessed by 2 objects.

Associate
Joined
30 Oct 2004
Posts
112
Location
Whitstable
Hey everyone,

I'm writing a program, in which a 2D array is being used. Basically, I have 2 other objects which update this array, and I want them to be able to update it at the same time.

Is this possible? I am thinking it is gonna be a 'concurrency' issue, but wondered if it was possible outside of doing this?

Cheers!
 
OK, so if they are both running in the same thread, then there is no problem?

My task is basically to create a game that runs over a network, and I'm using a 2D array as a 'grid', to represent the game board. Both objects have to be able to update at the same time over the network.

Its a uni assignment, and its doing my head in to say the least!
 
Yep, they will be running on different hosts.

So if I just make the 'update' method synchronised, i shouldn't have any problems?
 
Lagz said:
No offence but you dont really seem to have a clue what you are doing.

Hmmm, well, if everyone knew the answer to everything, then I guess there wouldn't be any need for this forum!

This is the exact reason I asked, so maybe these comments aren't neccessary??
 
Excellent, many thanks for all of your replys everyone! Hopefully I should be able to get some kind of model running!

Cheers! :)
 
Back
Top Bottom