Skip to content

Commit 8b659c4

Browse files
author
m999rvi
committed
better comment
1 parent 35e302c commit 8b659c4

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/main/java/api/java/lang/ShutdownHookDemo.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
public class ShutdownHookDemo {
44

5-
// a class that extends thread is to be called when the program does exit
6-
static class ShutDownHook extends Thread {
7-
public void run() {
8-
System.out.println("This thread part of the class ShutDownHook is executed after the main thread exited...");
9-
}
10-
}
11-
125
public static void main(String[] args) throws InterruptedException {
136
System.out.println("Demo of a Shutdown hook.");
147
Runtime.getRuntime().addShutdownHook(new ShutDownHook());
158
System.out.println("Waiting 5 second...");
169
Thread.sleep(5000);
1710
System.out.println("At the end of the main thread, the shutdownhook is executed");
1811
}
12+
13+
// a class that extends thread is to be called when the program does exit
14+
static class ShutDownHook extends Thread {
15+
public void run() {
16+
System.out.println("This thread, part of the class ShutDownHook, is executed after the main thread exited...");
17+
}
18+
}
1919
}

0 commit comments

Comments
 (0)