I am always getting Stimpy 100 times for all excution.
But exam reference saying the output for the following question is Ren Ren Ren...Stimpy Stimpy Stimpy
Thanks<br />Biby Thoms
Zhu Ho
Greenhorn
Joined: Aug 29, 2006
Posts: 1
posted
0
The thread for InnerRun never start so it won't be run. So only InnerRunTwo is run.
Shailesh Kumar
Greenhorn
Joined: Sep 04, 2006
Posts: 16
posted
0
Are you sure if it wasn't like this?
InnerRun ir = new InnerRun(); Thread t = new Thread(ir);//ir is passed here in the constructor
May be a printing mistake.
"Expect the Unexpected!!"<br /> <br />SCJP5,SCMAD
Dave Reinhardt
Ranch Hand
Joined: Aug 07, 2006
Posts: 54
posted
0
Unless this is a possible answer, I think there is a bug in the following code sample:
void start() { InnerRun ir = new InnerRun(); Thread t = new Thread(ir); //wasn't passed the runnable ir InnerRunTwo irr = new InnerRunTwo(t); Thread uu = new Thread(irr); t.start(); uu.start(); }
If you make this change then you will get 100 Ren and then 100 Stimpy. As it was in the original code, the thead t wasn't given a job(a runnable) to do.
Biby Thoms
Ranch Hand
Joined: Jan 10, 2006
Posts: 48
posted
0
You are correct Shail...Good catch. Thank you all
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.