This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have a class with an object which contains a list of Strings. In this class I have a runnable method where I want to access this object to add an element in his list.
However, it seems that in my runnable method, the object is not modified. No error is happening.
Also...maybe there are bits missing that would change this interpretation, but it looks like you're asking the Runnable to be executed in another thread, but then immediately checking the size of the list. Even if the Runnable is being executed correctly, there's no reason to believe that it would have been executed by the time you check it.
(I'm assuming that line 15 should be o.getList().size() or similar)