Back to project page androidtestdebug.
The source code is released under:
MIT License
If you think the Android project androidtestdebug listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
// ???????? // javac DeadLockDemo.java //// ww w . j a va2 s .c om public class DeadLockDemo { public static void main(String[] args) { final Object lock1 = new Object(); final Object lock2 = new Object(); Thread thread1 = new Thread(new Runnable() { @Override public void run() { synchronized (lock1) { System.out.println("???1???lock1"); try { Thread.sleep(50); } catch (InterruptedException e) {} synchronized (lock2) { System.out.println("???1???lock2"); } } } }); thread1.start(); Thread thread2 = new Thread(new Runnable() { @Override public void run() { synchronized (lock2) { System.out.println("???2???lock2"); try { Thread.sleep(50); } catch (InterruptedException e) {} synchronized (lock1) { System.out.println("???2???lock1"); } } } }); thread2.start(); try { thread1.join(); thread2.join(); } catch (InterruptedException e) {} System.out.println("????????????????????????"); } }