Specifications

Sun Services
Java™ Programming Language
Module 13, slide 11 of 37
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Terminating a Thread
1 public class ThreadController {
2 private Runner r = new Runner();
3 private Thread t = new Thread(r);
4
5 public void startThread() {
6 t.start();
7 }
8
9 public void stopThread() {
10 // use specific instance of Runner
11 r.stopRunning();
12 }
13 }