I'm kind of confused about this. I want to create two threads that works in the same data. For example if I have an array of Strings then I want this two threads to work in each unique item say add a letter 'p' in each strings. My question is where do I create this array of string is it outside/inside the Runnable class or create a new class with the array inside and the functions that access the contents of the array? I believe this also requires synchronization since I don't want the two threads to access the same data. Can someone give me an example? A pseudocode will do. Thanks in advance!
jazz_vill 0 Light Poster
jazz_vill 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.