import java.util.Scanner;

public class SleepTest
{
  public static void main(String[] args)
  {
    SleepThread sT = new SleepThread();  // create a thread and run it  
    sT.start();
    Scanner input = new Scanner(System.in);
    input.nextLine();                   // request user input
    sT.interrupt();                     // wake-up sleeping thread
  }
}

class SleepThread extends Thread
{
  public void run()
  {
    try
    {
      sleep(10000);                     // sleep for 10 sec
      System.out.println("thread slept for the entire period");
    }
    catch(InterruptedException e)       // required by using sleep() method
    {
      System.out.println("thread woke up from sleep");
    }
  }
}

