This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
harshvardhan ojha wrote:
also you got public void run() from superclass. Got it??
Hey thanks for the quick reply
Do you mean run() method is inherited from Addition into RunnableTest by your last statement?
Yes, that is correct. And doing so fulfills the Runnable interface's requirements. But it isn't really good practice since it makes it harder to associate the implemented method (run()) with the interface that requires it (Runnable). Either Addition should implement Runnable since it has the run() method, or the run() method should be moved to RunnableTest class since it implements Runnable. Either way, the 'implements Runnable' and run() method should be in the same class to keep things easy.