Sleep()-(指定毫秒數+納秒數)-T16
阿新 • • 發佈:2021-01-11
package 多執行緒技能1;
/**
* Sleep(long millis,int nanos):在指定的毫秒數加指定納秒數內讓當前正在執行的執行緒休眠
* ,此操作受到系統計時器和排程程式的精確度和準確性的影響
*/
class Test1{
public Test1() throws InterruptedException {
long beginTiome=System.currentTimeMillis();
Thread.sleep(2000,999);
long endTime=System.currentTimeMillis();
System.out.println(beginTiome=endTime);
}
}
public class T16 {
public static void main(String[] args) throws InterruptedException {
Test1 test1=new Test1();
}
}