The following program demonstrates a classic deadlock situation in which two threads attempt to acquire two locks, but in different orders.
The complete source code is available as a zip file.