i thought the program would fail compiling as we can not invoke run()method directly. but it works fine. WHY? I would appreciate if someone explains me. thanks. [ July 29, 2003: Message edited by: Namaste Sathi ]
Joel McNary
Bartender
Joined: Aug 20, 2001
Posts: 1815
posted
0
There's nothing preventing you from calling run: it is delared as public. The Thread class's run method does nothing (unless it was created with a Runnable object); but in your subclass here, it does do something.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Brian Smith
Ranch Hand
Joined: Oct 26, 2002
Posts: 232
posted
0
Joel, so it's not necessary true that we can't invoke run() method of a Thread directly. And also, we can't predict when the run()method gets excuted once the start() is invoked. right?
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
If you invoke the run() method then it is not running as a separate thread. run() is no different than any other method when invoked that way.