Which method you define as the starting point of new thread in a class from which new the thread can be excution?
A.public void start() B.public void run() C.public void int() D.public static void main(String args) E.public void runnable() I think that start() describes the starting point of a new thread in a program and run() describes the activity the started thread does. Is that true? Thomas
I would interpret this question as expecting the public void run() to be chosen as the answer. When the system gets around to running the thead it starts execution in the thread's run() method. Calling start() justs tells the system that it can schedule the thread to be run at sometime in the future. -Barry
in a class from which new the thread can be excution? Reading the question carefully (or as I'd intepret it - concerning whether I'm careful you'll receive differing opinions), I think this quoted part would indicate that start() is the correct answer. The question would seem to be asking how to start a thread from some other class. If you just use run(), a new thread isn't created. On a side note: Sometimes I don't really understand why the author of a question didn't just directly ask what they were getting at. I can understand trying to test one's understanding by asking questions in a different way, but sometimes they confuse the situation and obscure the actual purpose of the question too much while adding a possible second (or more) interpretation of the question based on its wording. OK, that's enough blah-blah nonsense from me...
Dirk, my interpretation of this is that method start has been called, and method run is where the started thread begins execution when the thread scheduler gets around to it. run is the method I would define. It's 80% question interpretation and 20% finding the answer. (However, that 20% can be a pretty big chunk.) -Barry [ October 15, 2002: Message edited by: Barry Gaunt ]
Joined: Dec 10, 2001
I won't stand strongly behind my opinion (guess) this time. You may well be correct. I suspect that a grammar correction may well help to aleviate some ambiguity. At any rate, to begin to understand the threading model in Java, The Threads Lesson of Sun's Java Tutorial is a good place to start.