What thread executes the main method?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • venub
    New Member
    • Feb 2008
    • 1

    What thread executes the main method?

    public static void main() is the userthread or deamon thread?
    thanxs in advance
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    Originally posted by venub
    public static void main() is the userthread or deamon thread?
    thanxs in advance
    "main()" means stand-alone program.
    So if executed, it's a process, not a thread.
    Inside your stand-alone program, you can open threads. Either demon or normal threads.

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      Clearly, the thread that starts executing the main method can't be a daemon. If it were your program should immediately stop! But don't believe me -- check for yourself:

      [CODE=Java]System.out.prin tln(Thread.curr entThread().isD aemon());[/CODE]

      Comment

      Working...