Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Simple1 extends Thread{
- public void run(){
- System.out.println("Tom Start");
- try{Thread.sleep(50);}catch(InterruptedException e)
- {System.out.println(e);}
- try{Thread.sleep(50);}catch(InterruptedException e)
- {System.out.println(e);}
- System.out.println("Tom Reach");
- }
- }
- class Simple2 extends Thread{
- public void run(){
- System.out.println("Jerry Start");
- try{Thread.sleep(50);}catch(InterruptedException e)
- {System.out.println(e);}
- System.out.println("Jerry Reach");
- }
- }
- class Simple3 extends Thread{
- public void run(){
- System.out.println("Jhon start");
- try{Thread.sleep(500);}catch(InterruptedException e)
- {System.out.println(e);}
- System.out.println("Jhon reach");
- }
- }
- class TestMultitasking3{
- public static void main(String args[]){
- Simple1 t1=new Simple1();
- Simple2 t2=new Simple2();
- Simple3 t3=new Simple3();
- t1.start();
- t2.start();
- t3.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment