Could you please explain why no 56 correct and what is the different between this tow answers !!? merci! When does the JVM exit?
1-After the main method returns. 2-After all the non demons threads created by the application complete. 3-After all the demon threads created by the application complete 4-When a thread executes System.exit(); 5-When an uncaught exception is thrown in a non demon thread. 6-When an uncaught exception is thrown in a demon thread.
SCJP,SCWCD,CCNA,CCAI,MCP,MCSA,MCSE<br />working on CCNP+SCBCD
Hi Bill: If other thread(s) are to continue, then JVM does NOT exit. So can we say 5 and 6 are correct answers? Barkat
Joined: Jun 27, 2002
William Brogden As yopu said (there may be other non-demon Threads that are running, so the exception will just be reported and the other Thread(s) will continue. Bill) does the JVM exit? How (comment)??!
The JVM will ALWAYS exit when someone says "System.exit()" regardless of how many threads (daemon or not) are still alive. For bonus points, here are a few JVM exit and Garbage Collection (gc) questions for you to think about. They are in the spirit of the exam... Which of these are true? 1. Once an overridden finalize() method is invoked, there is no way to make the object ineligible for gc 2. All objects that have an overridden finalize() method are guaranteed to have their finalize() called before the JVM shuts down, unless it shuts down because of an error or exception. 3. Objects which have at least one reference referring to them will never be garbage collected. (in other words, if object 1 has a reference to object 2, then object 2 cannot be garbage collected) 4. Once a finally block is invoked, it will always run to completion. 5.Once a try block is entered, a matching finally block will always be invoked (regardless of the outcome of the try/catch) have fun.