I didn't make a deadlock. The two threads ran to completion.
Type: Posts; User: Norm
I didn't make a deadlock. The two threads ran to completion.
The code creates two instances with the following statements:
Runnable job1 = new DeadLockSample().new Job1();
Runnable job2 = new DeadLockSample().new Job2();
I didn't for me....
Yes.
The print out shows that there are two Foo objects, one for each thread. For synchronize to work, there must be one object that all methods use.
For a quick and dirty test, make the foo...
Are the threads locking on the same object?
Add some debug code to print out the class objects addresses: this
Add a constructor to Foo that prints out its this value.