只接写要实现什么东西啦
int statue=1;
int time=300;
现在要写一个timer计时器,如果时间超过300S,就把statue变为0
------解决方案--------------------
用线程嘛
- Java code
new Thread() { public void run() { try { sleep(time * 1000); } catch (InterruptedException e) { } status = 0; } }.start();
new Thread() { public void run() { try { sleep(time * 1000); } catch (InterruptedException e) { } status = 0; } }.start();