我用过" e" varible而不是goto! 在我的代码" e"变量未知
int e=1;
while(e==1)
{
if (now.getMinute() == end_minute && now.getSecond() >= second ) break;
new java.util.Timer().schedule(new java.util.TimerTask() {
@Override
public void run() {
System.out.println("hello!");
if (now.getMinute() == end_minute && now.getSecond() >= second ) e=0;
}
}, 60000);
}
感谢。
答案 0 :(得分:0)
你能检查一下吗?
package general;
import java.time.LocalDateTime;
public class TestTimer {
public static int e = 1;
public static void main(String[] args) throws InterruptedException {
LocalDateTime now = LocalDateTime.now();
int end_minute = 45;
int second = 30;
while(e==1)
{
if (now.getMinute() == end_minute && now.getSecond() >= second ) break;
new java.util.Timer().schedule(new java.util.TimerTask() {
@Override
public void run() {
System.out.println("hello!");
if (now.getMinute() == end_minute && now.getSecond() >= second )
e=0;
}
}, 60000);
}
}
}