Skip to content

Instantly share code, notes, and snippets.

@taka2
Created March 15, 2012 01:07
Show Gist options
  • Select an option

  • Save taka2/2040937 to your computer and use it in GitHub Desktop.

Select an option

Save taka2/2040937 to your computer and use it in GitHub Desktop.
Timerでもデーモンスレッドにすることが可能
import java.util.Timer;
import java.util.TimerTask;
public class test {
public static void main(String[] args) throws Exception {
Timer timer = new Timer(true);
timer.schedule(new TimerTask() {
public void run() {
System.out.println("Hello!");
}
}, 0, 1000);
Thread.sleep(5000);
throw new NoClassDefFoundError();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment