This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Line 4 is calling the Thread constructor that takes a Runnable parameter. The Javadoc for this constructor shows it creates a Thread object that will delegate to the parameter's class when start/run are called.
But I still have one confusion. why we use super() here? As it is used to call superclass method, and is that is the case superclass, in this case "Thread" , its run() should be called which will do nothing.
Am I right?
author & internet detective
But as a cool note, this calls the delegated Runnable via super.run() in addition to the current thread. So it makes sense - if you override run and mask the default behavior, it no longer delegates to the runnable. If you keep the superclass' run via calling it from your run, the logical behavior is still there.