我使用了一种方法来保持主方法运行。
public static void main(String[] args) throws InterruptedException {
while (true) {
TimeUnit.SECONDS.sleep(1);
}
}
但是我不确定这是否是最好的方式。
有人能给我一些建议吗?