This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "thread" Watch "thread" New topic
Author

thread

rahul R khanna
Greenhorn

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[])
{
System.out.println("----a-----");
}
}
public class b
{
public static void main(String args[])
{
System.out.println("----b-----");
a.main(new String[10]);
}
}


someone expalain this please.

regards
rahul
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3415
    
  12
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.


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