Saturday, September 27, 2014

Wait and Notify

public class Threading {      
    public static void main(String[] args) {
   
     
final  Runnable one = new Runnable() {

                public void run() {
                 
//                    SomeOpeartion();
one .notify();


                }
                   
            };
            one.run();

 final Runnable two = new Runnable() {

                public void run() {

    two .wait();
//    SomeOpeartion();
    two .notify();
}
                 

               
            };
         


 final Runnable three= new Runnable() {

                public void run() {

    three.wait();
//    SomeOpeartion();
    three .notify();
}
                 

               
            };
            three.run();

final  Runnable four =new Runnable() {

                public void run() {

    four.wait();
//    SomeOpeartion();
    four .notify();

                 

               
            };
            four.run();


         final   Runnable five= new Runnable() {

                public void run() {

    five.wait();
//    SomeOpeartion();
    five .notify();
}
                 
               
            });
   

    }}}
           




//Thread blocks because of RuntimeException?

No comments:

Post a Comment