File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "thread" Watch "thread" New topic


rahul R khanna

Joined: Apr 26, 2008
Posts: 10
main() method of a class can be invoked in another class.
Whenever Main method is called, a Main thread gets started right?
In this case how many threads get started?
class a
static void main(String args[])
public class b
public static void main(String args[])
a.main(new String[10]);

someone expalain this please.

Joanne Neal

Joined: Aug 05, 2005
Posts: 3169
Originally posted by rahul R khanna:
Whenever Main method is called, a Main thread gets started right?

No. There is nothing special about the main method. It's just like any other method. When it is used as the entry point to a java program, the JVM creates a thread and then calls the main method using that thread.

I agree. Here's the link:
subject: thread
Similar Threads
synchronized Combination of WA and Opensource?
Threads - join()
Comilation Problem
Threads doubt??
Can a class has two main's