*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Create and launch a new thread 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 "Create and launch a new thread" Watch "Create and launch a new thread" New topic
Author

Create and launch a new thread

HiBob Chu
Ranch Hand

Joined: Aug 12, 2002
Posts: 86
Which method in the Thread class is used to create and launch a new thread of execution?
A. Run();
B. Start();
B. Execute();
C. Run(Runnable r);
D. Start(Runnable r);
E. Execute(Thread t);
Answer: B
I think D is right too.
zarina mohammad
Ranch Hand

Joined: Jun 26, 2002
Posts: 104
start() method does not take any parameters.
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
You can usually resolve your doubts by checking the documentation.
Also, Java is case-sensitive.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
The correct answer is none of the above. The correct method is start().


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
HiBob Chu
Ranch Hand

Joined: Aug 12, 2002
Posts: 86
Hi I remember wrong:
If want to creat and excute a
thread with another object which
don't extends thread class, should
pass the object into thread constructor
instead of it's start function.
Thansk above!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create and launch a new thread