| |||||||||||||||||
Answer: Option A
Explanation:
If a Runnable object is passed to the Thread constructor, then the run method of theThread class will invoke the run method of the Runnable object.
In this case, however, the run method in the Thread class is overridden by the run method in MyThread class. Therefore the run() method in MyRunnable is never invoked.
Both times, the run() method in MyThread is invoked instead.
Reference: http://www.indiabix.com/online-test/java-programming-test/61
|
Friday, October 30, 2015
Thread And Runnable both have run method which one will be called?
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment