Page 1 of 1
					
				About Question enthuware.ocpjp.v7.2.1291 :
				Posted: Sun Jul 03, 2016 8:28 am
				by homeric
				I did not understand why it executes Pooler's run(). A new Threader() is passed to Pooler's run(Runnable r). Then super(r) calls run() of Thread class that executes Runnable's run(). Since Runnable r contains Threader object it should be printing 'In threader'. 
Where am I going wrong?
			 
			
					
				Re: About Question enthuware.ocpjp.v7.2.1291 :
				Posted: Sun Jul 03, 2016 9:11 am
				by admin
				Why do you think "then super(r) calls run() of Thread class"?
			 
			
					
				Re: About Question enthuware.ocpjp.v7.2.1291 :
				Posted: Sun Jul 03, 2016 9:42 am
				by homeric
				Pooler extends Thread so call to super(r) will execute run(Runnable) of Thread.
			 
			
					
				Re: About Question enthuware.ocpjp.v7.2.1291 :
				Posted: Sun Jul 03, 2016 9:50 am
				by admin
				Again, why do you think that super(r) will execute run(Runnable) at all? Thread's run is called when you start a thread, not when you create a thread.
			 
			
					
				Re: About Question enthuware.ocpjp.v7.2.1291 :
				Posted: Sun Jul 03, 2016 9:59 am
				by homeric
				I got it now. Will h.start() call Pooler's run() method directly because h has been assigned a Pooler object?
			 
			
					
				Re: About Question enthuware.ocpjp.v7.2.1291 :
				Posted: Sun Jul 03, 2016 10:46 am
				by admin
				That is correct. But go through the explanation again for more clarity.