/** This program is intended to be used with the book "Java 6 -- Java 6 -- What 
 * Do You Want To Do?" by Steven P. Warr and is distributed free of charge and 
 * without and expectations of remuneration.  Chapter APP   NOTE all program 
 * names begin with the title of the chapter in which they are intended to be 
 * used.   Copyright 2010 Steven P. Warr All rights reserved.
 *
 *These classes demonstrate threads and the unpredictability of which thread
 *sequence will execute.   Note that the start () method in an applet is not
 *necessary and the program executes the same way without it.  
 *
 *Threads in an application.
 */


import java.util.*;
public class App03 
{                      
    public static void main(String [] arg)
    {
        App03a a = new App03a();
        App03b b = new App03b();
        App03c c = new App03c();
        Thread ta = new Thread(a);
        Thread tb = new Thread(b);
        Thread tc = new Thread(c);
        ta.start();
        tb.start();
        tc.start();
    }	
}
class App03a implements Runnable
{                      
    public void run ()
    {
    	while(true)
          {
    		  Date now = new Date();
    	      System.out.println(now + " App03a");
     	      try
    	         {
    	            Thread.sleep(1500);
    	         }
    	      catch (Exception e) {}      
    	  }    
    }		
 			           
}   
class App03b implements Runnable
{                      
    public void run ()
    {
    	while(true)
          {
    		  Date now = new Date();
    	      System.out.println(now + " App03b");
    	      try
    	         {
    	            Thread.sleep(1500);
    	         }
    	      catch (Exception e) {}      
    	  }    
    }		
 			           
}   
class App03c implements Runnable
{                      
    public void run ()
    {
    	while(true)
          {
    		  Date now = new Date();
    	      System.out.println(now + " App03c");
    	      try
    	         {
    	            Thread.sleep(1500);
    	         }
    	      catch (Exception e) {}      
    	  }    
    }		
 			           
}    