package Demo;
import java.util.*;
import java.io.*;
public class loop {
    public static void main(String[] args) {
        try{//获取当前时间,以及sleep
            long start = System.currentTimeMillis();
            for (int i = 0; i<5; i++){
                Thread.sleep(1000);
                System.out.println(i);
            }
            long end = System.currentTimeMillis();
            long diff = (end - start)/1000;
            System.out.println("。。。。。"+diff);
        }catch (Exception e){
            e.printStackTrace();
            System.out.println(e);
        }

    }
}

 

相关文章:

  • 2021-12-21
  • 2022-01-05
  • 2021-12-10
  • 2022-12-23
猜你喜欢
  • 2021-06-13
  • 2021-12-20
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案