• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there any method which creates..........?

 
Manjunath Hirennavar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody
Is there any method which creates a Thread. I encountered a question like

Which of the following method is used to create a Thread
1. start()
2. run()
3.
 
Murali Kakarla
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think we can create a Thread using a method.

Can you please tell us the source of the question and also please post complete question with all options?

Murali...
SCJP 5 Aspirant
 
Manjunath Hirennavar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Murali,
I am preparing for SCJP 5 and my senior is giving me the questions so that i can realize the toughness of quwstions and be able to clear it. So before arguing with my senior i just wanted to confirm whether this question is right.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15452
42
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With "create a Thread", what is most likely meant here is not a new java.lang.Thread object, but a new thread that will start to run in parallell. You use the start() method of class Thread to do this, so the answer is 1.
 
Amit Mahajan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
start() method creates a new stack on which your thread executes..
Hence answer is start() method , but actuall excecution starts when run() is called.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic