Program termination: Difference between revisions

Content deleted Content added
Line 222:
 
You can use <code>Runtime.getRuntime().addShutdownHook(myThread);</code> to add threads which represent actions to be run when the program exits.
 
This one does not perform cleanup:
<lang java>if(problem){
Runtime.getRuntime().halt(integerErrorCode);
//conventionally, error code 0 is the code for "OK",
// while anything else is an actual problem
}</lang>
 
=={{header|Logo}}==