aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes For an object to be a target for a Thread, that object must be of type: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "For an object to be a target for a Thread, that object must be of type: " Watch "For an object to be a target for a Thread, that object must be of type: " New topic
Author

For an object to be a target for a Thread, that object must be of type:

josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
thread and runnable are true is 'nt it??
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
Either a Thread or a Runnable object; yes.


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Err... how can a Thread have another Thread as its target? I don't see any constructors or methods which achieve this. For comparision, the constructor Thread(Runnable target) makes a runnable object the target for a Thread. But I don't see a Thread(Thread target) anywhere.

"I'm not back." - Bill Harding, Twister
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Jim,
Do you think the question meant this? What do you say is right.There is no Thread constructor taking a Thread object as an input.But the class java.lang.Thread class itself implements the Runnable interface which means a Thread object can be substituted for an Runnable object right? I checked this with the foll. code. It compiles and prints 'maha'.
regds
maha anna
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Oops. I missed the obvious. Thanks maha anna!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: For an object to be a target for a Thread, that object must be of type: