5.25学习内容java死锁,脸部

package 死锁;
class A{
    synchronized void funA(B b){
        String name = Thread.currentThread().getName();
        System.out.println(name+"进入A.foo");
        /*try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }*/
        System.out.println(name+"调用B类的last方法");
        b.last();
    }
    synchronized void last()
    {
        System.out.println("A的last方法");
    }
}
class B{
    synchronized void funB(A a){
        String name = Thread.currentThread().getName();
        System.out.println(name+"进入B.foo");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println(name+"调用A类的last方法");
        a.last();
    }
    synchronized void last()
    {
        System.out.println("B的last方法");
    }
}
public class DeadLockDemo implements Runnable{
    A a=new A();
    B b=new B();
    public DeadLockDemo() {
        // TODO Auto-generated constructor stub
        new Thread(this).start();
        a.funA(b);



    }
    public void run(){
        b.funB(a);
    }
    public static void main(String []args)
    {

            new DeadLockDemo();

    }
}


脸部磨皮去黑眼圈算法:

http://blog.csdn.net/bloodbreaker/article/details/45958961





你可能感兴趣的:(android)