synchronization in thread

hello, folks. I am trying to synchronize two thread which can both sell tickets. The follwoing is my code:

Then I got my result. It is just a single thread which is trying to "sell" the 100 tickets. However,if I change the order of main method like the following:

I got two threads running which are trying to "sell" the tickets. I do not really know what is happening here. Can anyone let me know what is going on with it? Does it make any difference where I put "st.b = true;" ?