dcsimg
if a class extends Thread class and also implements Runnable interface?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   karthi_keyan
Posted On:   Thursday, December 6, 2007 05:23 AM

if a class extends Thread class and also implements Runnable interface then Which method will be overrided either Thread class run method or runnable interface method? class NewThread extends Thread implements Runnable { Thread t; NewThread() { start(); //this may call thread class run method t=new Thread(this, "implentation"); t.start();//this may call runnable inter run method } public void run() { System.out.println("Run method called"); }    More>>

if a class extends Thread class and also implements
Runnable interface then Which method will be overrided
either Thread class run method or runnable interface method?





class NewThread extends Thread implements Runnable


{


Thread t;



NewThread()


{


start(); //this may call thread class run method


t=new Thread(this, "implentation");


t.start();//this may call runnable inter run method



}


public void run()


{



System.out.println("Run method called");



}



}

   <<Less

Re: if a class extends Thread class and also implements Runnable interface?

Posted By:   Robert_Lybarger  
Posted On:   Thursday, December 6, 2007 09:45 AM

Terminology: you only override the "run()" method in the Thread parent class; however, this counts as providing an implementation of the abstract "run()" method declared in the Runnable interface.

Re: if a class extends Thread class and also implements Runnable interface?

Posted By:   sreenath_reddy  
Posted On:   Thursday, December 6, 2007 06:04 AM

Runnable interface.

We have to konw one thing Thread class implements Runnable interface only. So the run method exists in thread class is equal to Runnable interface run method.
About | Sitemap | Contact