[3852] in java-interest
[Fwd: start() method confusing -- a really good question.]
daemon@ATHENA.MIT.EDU (John D. Kane)
Wed Nov 29 22:31:27 1995
Date: Wed, 29 Nov 1995 19:57:57 -0500
From: "John D. Kane" <john@insightnews.com>
To: java-interest@java.sun.com
Path: news.worldlinx.com!news
From: "John D. Kane" <john@insightnews.com>
Newsgroups: comp.lang.java
Subject: start() method confusing -- a really good question.
Date: Wed, 29 Nov 1995 19:55:51 -0500
Organization: INSIGHT New Media Publishing
Lines: 25
Message-ID: <30BD0117.E08@insightnews.com>
NNTP-Posting-Host: 204.101.142.10
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0b2 (Windows; I; 32bit)
Why is an instance of a Thread often made inside the start method
with another call to what looks like the same start method to
start that new thread?
For example,
class whatever {
...
public void start() {
Thread threadToRun = new Thread(this);
threadToRun.start();
}
...
}
I can't understand why this isn't recursive. It looks like start
calling start calling start calling ... and so on.
I think it looks like this because the new thread is an instance of
the same class. Shouldn't the thread call it's own start method,
which is really the same one it's already in?
I need some help with this. I can write applets using this method,
but it drives me crazy that I can't understand why it works. If
anyone knows the answer or has any theories, or knows where there's
some good documentation on the whole issue of start(), run(),
stop(), but more specifically start(), please let me know.
John
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com