1. 程式人生 > 其它 >Sleep()-(指定毫秒數+納秒數)-T16

Sleep()-(指定毫秒數+納秒數)-T16

技術標籤:多執行緒Threadthread多執行緒java

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(); } }

在這裡插入圖片描述