Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Query:What does main thread do in java?

Thread view: 
Jack Dowson - 04 May 2007 07:43 GMT
Hello Everybody:
I'm new to java.
I want to know what does main thread do when a java program is excuting!
Thanks in advance!
Andrew Thompson - 04 May 2007 08:38 GMT
...
>I'm new to java.

A good group for those new to Java, is
comp.lang.java.help
but even there..

>I want to know what does main thread do when a java program is excuting!

.you will be expected to read your textbooks, do a
bit if googling, and ask a smart question.
<http://www.catb.org/~esr/faqs/smart-questions.html>

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Thomas Fritsch - 04 May 2007 13:47 GMT
> I'm new to java.
> I want to know what does main thread do when a java program is excuting!
It calls your method
 static void main(String[] args)

Signature

Thomas

Patricia Shanahan - 04 May 2007 14:17 GMT
>> I'm new to java.
>> I want to know what does main thread do when a java program is excuting!
> It calls your method
>   static void main(String[] args)

and therefore runs the main method itself, and everything called from
it, directly or indirectly.

It is perhaps better to think about things that it does NOT run:

Administrative work, such a garbage collection, that the JVM chooses to
do from another thread.

Event handling.

Anything that you put in a different thread, by creating a Thread and
calling its start() method.

Patricia
Jack Dowson - 04 May 2007 14:51 GMT
Patricia Shanahan 写道:
>>> I'm new to java.
>>> I want to know what does main thread do when a java program is excuting!
[quoted text clipped - 15 lines]
>
> Patricia
Really thank you!
That means sometimes the program does not terminate when main thread is
over?Right?

Dowson.
Thomas Fritsch - 04 May 2007 17:41 GMT
[...]
> That means sometimes the program does not terminate when main thread is
> over?Right?
Yes, right!
Actually this is how all applications with a GUI (graphical user interface)
work. Their main thread usually finishes after less than one second. But
other threads continue for minutes (or even hours).

Signature

Thomas



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.