Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
//Hier dein Code. Der sollte aber nicht zu lange dauern!
}
}));
CPoly, du bist schnell...
2.Shutdownhook wird doch ausgelöst wenn das Betriebssystem runterfährt nicht wenn ich das Progamm schliesse.
The Java virtual machine shuts down in response to two kinds of events:
The program exits normally, when the last non-daemon thread exits or when the exit (equivalently, System.exit) method is invoked, or
The virtual machine is terminated in response to a user interrupt, such as typing ^C, or a system-wide event, such as user logoff or system shutdown.
Danke XD
Ich hate es anders in Erinnerung. SRY
class Shutdown {
public static void main(String[] args) throws Exception {
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
System.out.println("Wird beendet.");
}
}));
System.in.read();
}
}