<<< Example: Creating a thread | Index | Sample output for the IOThread example >>> |
public class IOThread extends Thread
{
@Override
public void run()
{
System.out.println( this.getName() + " started" );
try
{
// Sleep for 2 seconds to simulate an IO task
// that takes a long time
Thread.sleep( 2000 );
}
catch( InterruptedException ex )
{
}
System.out.println( this.getName() + " finished" );
}
}
<<< Example: Creating a thread | Index | Sample output for the IOThread example >>> |