/**
* @author lautturi.com
* Java example: Java settimeout
*/
import java.io.File;
import java.io.IOException;
import java.util.*;
public class Lautturi {
public static void setTimeout(Runnable runnable, int delay) {
new Thread(() -> {
try {
Thread.sleep(delay);
runnable.run();
} catch (Exception e) {
System.err.println(e);
}
}).start();
}
public static void main(String[] args) throws IOException {
setTimeout(() -> System.out.println("waiting for 3 seconds"), 3000);
}
}