class ADaemon implements Runnable {
public void run() {
try {
System.out.println("Запускаем ADaemon");
Thread.sleep(1);
} catch (InterruptedException e) {
System.out.println("Выход через InterruptedException");
} finally {
System.out.println("Должно выполняться всегда?");
}
}
}
public class DaemonsDontRunFinally {
public static void main(String[] args) {
Thread t = new Thread(new ADaemon());
t.setDaemon(true);
t.start();
}
}
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать