hi Vivek,
well, if your program runs on the EDT, then I suggest you use 4 Swingworkers, and retrieve the answers in the 'done()' method.
This 'done()' method runs on the EDT as well, so you would not get any synchronisation problem here.
If you are not running from the EDT, then one possibility is: create, say, an ArrayLIst<
String> (an Array would do fine as well),
start four threads, each writing to the arraylist once it has an answer. But for this writing, synchronize on this arraylist.
Then, for your main thread, join the four threads. You know then when there are four answers.
And then you could use executors, but that would be a bit overkill in this case.
Greetz,
Piet