Hi, This question is from jwhiz. Please take a look at the code and options. What will be the output when you compile and execute the following program?
Answer choices: A. Three times "Threadable: Running.." and three time "Base: Running.." B. "Threadable: Running".. in a loop C. "Base: Running".. in a loop D. Depends on the Operating System and on Virtual Machine E. Compilation error: Cannot Implement Runnable interface and extend Thread class at same time.
Given correct choice is A. But I think the choice D is correct, since which thread will get started will depends on the os. Can anyone clarify this? Thanks, Vanitha.
I think that A is correct as it will print Three times "Threadable: Running.." and three time "Base: Running.." , we can not be sure of the order of execution which definately Depends on the Operating System and on Virtual Machine, but in whatever order, it will print as given in option A . Please correct me if I am wrong. --Farooq
[This message has been edited by Muhammad Farooq (edited September 02, 2001).]
Muhammad Farooq<br />Sun Certified Programmer for Java 2 Platform<br />Oracle8i Certified Professional Database Administrator
Thanks for your replies, Leena, Farooq and Mathias. I agree that it will print 3 times Thread.. and 3 times Base... I thought in the first choice they are giving importance to the order. That's why I choose choice D because we can't be sure about the order. Ok, I got to read the choices twice. Thanks again, Vanitha.
I'm so happy! And I wish to make this tiny ad happy too: