A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
15
Task/Handle-a-signal/Java/handle-a-signal-2.java
Normal file
15
Task/Handle-a-signal/Java/handle-a-signal-2.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
public class ExampleSignalHandler {
|
||||
public static void main(String... args) throws InterruptedException {
|
||||
final long start = System.nanoTime();
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||
public void run() {
|
||||
System.out.format("\nProgram execution took %f seconds\n", (System.nanoTime() - start) / 1e9f);
|
||||
}
|
||||
}));
|
||||
int counter = 0;
|
||||
while(true) {
|
||||
System.out.println(counter++);
|
||||
Thread.sleep(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue