Hi Yasir, Runnable isn't a class, its an interface with just one method:
The class Thread implements Runnable, but its run method doesn't do anything so you have to overload it if you extend Thread and want to do some work in a separate thread. Most of the time programmers choose to implement the Runnable interface since that allows them to extend a different more appropriate class for the type of work they are doing. This works fine because the Thread class has a constructor which takes a Runnable as a parameter. After the Thread object is constructed then all you have to do is call its start() method and your Runnable is off and running (sorry for the pun) like this:
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Michael Morris
Ranch Hand
Joined: Jan 30, 2002
Posts: 3451
posted
0
I meant that you have to override the run() method, not overload it. Sorry about that Michael Morris SCJP