Question 46: If you supply a target object when you create a new
Thread t = new Thread(targetObject);
What
test of instanceof does targetObject have to pass for this to be legal?
Select the one right answer.
a) targetObject instanceof Thread
b) targetObject instanceof Object
c) targetObject instanceof
Applet d) targetObject instanceof Runnable
e) targetObject instanceof
String the given ans:BD
I look up the Thread find the description as following :
public Thread(Runnable target)
target - the object whose run method is called.
So I think :
The target object for a Thread must implement Runnable, which means it will pass the test:
targetObject instanceof Runnable
because the Thread is the suclass that implents the Runnable interface ,it is ok.while the Object is supper-class of the Runnable ,it is no ok.
above all above ,I thought the correct ans is:AD.
If I am wrong ,pls correct me.
You are always to the issue.