Hi ,
As I was going through threads I just want to know the process of creating the threads is two way either by extending thread class or by implementing runnable interface, My query is that why the java have provided the two ways , I am doing lot of googling for that ,I just wanted to know what's the technical reason behind introduing the two ways..!!
There just two different approaches both of which have been superseded to some extent. Implementing runnable is usually the preferred choice one reason for which is inheritance i.e. If you have sub classed thread you can't inherit from anything else (multiple inheritance), I guess if you were a beginner you might find the concept of a Thread class more natural and its a wrapper for other methods i.e. it represents a thread rather than a unit of work so it does have its uses.
You should probably me more looking at Executors / Tasks etc in modern java.
"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5