なぜこれは動作しませんか?javaタイマーは機能しません
毎秒印刷したいと思います。
ありがとうございました。
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class test2 {
public static void main(String[] args) {
Timer timer = new Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("hello");
}
});
timer.start();
}
}
[我々はウィンドウを生成しない場合は、なぜタイマーが動作しない?]の可能複製(http://stackoverflow.com/questions/2478505/why-timer-does-not-work-if-we-do-未生成-ウィンドウ) – Grodriguez