• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Thread

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1)JVM exits when uncaught exception is thrown in daemon thread.
2)Thread th = new Thread();
th.start() causes the thread to start running and eventually complete its execution. The object reference by th is not accessable any more and is garbage collected when the garbage collecter runs.
is true.
Are the above statements true?

[This message has been edited by avn (edited August 20, 2000).]
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first statement is definitely false.
The daemon threads serve to provide a service in the background.
They live as long as the program lives (at least one non-daemon thread). But their death do not influence the running program.
So, any unchecked exceptions thrown by daemon threads will never quit the JVM.
The second statement is false too. According to "Thinking in Java" by Bruce Eckel:
"Each Thread �registers� itself so there is actually a reference to it someplace and the garbage collector can�t clean it up."
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic