// example use of Thread.sleep
try
   {
   // Sleep at least n milliseconds.
   // 1 millisecond = 1/1000 of a second.
   Thread.sleep( n );
   }
catch ( InterruptedException e )
   {
   out.println( "awakened prematurely" );

   // If you want to simulate the interrupt happening
   // just after awakening, use the following line
   // so that our NEXT sleep or wait
   // will be interrupted immediately.
   // Thread.currentThread().interrupt();
   // Or have have same other thread awaken us:
   // Thread us;
   // ...
   // us = Thread.currentThread();
   // ...
   // us.interrupt();
   }