It depends on your appl's class hierarchy. If your class can subclass the Thread class and override run(), you may choose to use the fact that the Thread class implements Runnable. Otherwise, use 2 separate objects for Thread and Runnable.
There has been extensive discussion in other threads about the difference between extending Thread and implementing Runnable. Search the forums for that.
One extra point. It seems that there is often confusion between instances of the Java class java.lang.Thread, active Java threads and operating system threads.
The class java.lang.Thread is a Java class than you can instantiate, but just instantiating it does not start a new active Java thread. Only when you call start() does a new Java thread become active. Also, after the Java thread has finished running, the instance of java.lang.Thread remains accessible, until all references to it have gone away.
There is an instance of java.lang.Thread for every active Java thread, but there is not necessarily an active Java thread for ever instance of java.lang.Thread.
While modern JVMs often do have one operating system thread per active Java thread, there is no necessity for this to be true. The JVM is free to implement java.lang.Thread any way it likes, providing that the implementation adheres to the specification. And the specification deliberately allows quite a lot of lattitude.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop