laman

Rabu, 21 Desember 2011

SleepingThread

public class SleepingThread extends Thread
{
    final public static int END=100;
    final public static int TEN_SECONDS=1000;
    public void run()
    {
        for(int x=1;x<=END;x++)
        {
            System.out.print(x+" ");
        try
        {
            if (x%25==0){
                System.out.print("\n");
        sleep(TEN_SECONDS);
            }
        }
        catch(InterruptedException e){
        }
        }
    }
   
}

Tidak ada komentar:

Posting Komentar