Odd even number printing using thread.Create one thread class, two instance of the thread. One will print the odd number and the other will print the even number.
I think the problem might be that printOdd and printEven synchronize on different lock (the Thread's object instance locks). Therefor you have not guaranteed that the change on the static variable oddTurn will be visible in the other thread. Try to make the oddTurn volatile for the start.