This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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
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 ]