Hi Java'sSocialWorkers:-), A class that has a main() method may or may not implement the Runnable Interface or extend the Thread class then how the main() is called the first non-daemon thread that JMV runs when the class is loaded.further the JVM only calls the run() method of the class to which the thread belongs.
Hard work beats talent<br />when talent doesn't work hard.<p> - Tim Notke
Joined: Jul 03, 2001
The thread that executes an application has been named "main" because it executes the code in the main method. The class holding the main method is not otherwise related to this thread.
SCJP2. Please Indent your code using UBB Code
Joined: Mar 05, 2003
How is main a thread? Even if the virtual machine is not actually coded this way, it seems like a reasonable way the virtual machine could start the main thread:
The idea here is that the virtual machine (theoretically) creates a Runnable object that invokes the static method main. Then it creates a Thread object and passes that Runnable object as the thread target. Notice how this can explain why we can throw checked exceptions from main(). Why am I spreading such myths? Until I find out how it really works, this is how I explain to myself how the main thread is just like any other thread. But I defer to Jose, our virtual machine expert. [ October 06, 2003: Message edited by: Marlene Miller ]