aspose file tools*
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
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: 3568
    
  15
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