public static void main(String[] args) { long begain = System.currentTimeMillis();//开始系统时间 try { Thread.sleep(100); } catch (Exception e) { e.printStackTrace(); } long CheckTime = System.currentTimeMillis(); //判断时间 while(true){ System.out.println(CheckTime-begain); try { Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } CheckTime = System.currentTimeMillis(); if((CheckTime-begain)>=(30*1000)){//判断时候到30秒 System.out.println("30秒后结束"); break; } } }给你的答案希望你能满意
顶一下
(0)
0%
踩一下
(0)
0%
- 相关评论
- 我要评论
-