//package multithreading;

public class ConsoleApp {
	
   private String letters ="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
   private int index = 0;

   /**
    * @param args - not used
    */
   public static void main(String[] args) {
      System.out.println("main() started on thread " + Thread.currentThread().getId() );
      ConsoleApp me = new ConsoleApp(); // create an instance of ourself
		
      me.methodA(); // invoke a method that takes a while to execute...

      System.out.println("Done!!!");
   }

   // This method prints the contents of a String to the console,
   // pausing a little between each character, so that it takes a while to complete.
   private void methodA() {
      long id = Thread.currentThread().getId();
      while( index < letters.length() ) {
         System.out.println(letters.charAt(index) +","+id );
         index++;
         try {
            Thread.sleep(250);
         } catch (InterruptedException e) { // we were awakened early...
            // do nothing; just continue while() loop
         }
      }
   }
}
