Here you can find the source of sleep(long millis)
Parameter | Description |
---|---|
millis | - the length of time to sleep in milliseconds |
public static final void sleep(long millis)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w. ja v a 2s. c om * The function causes the currently executing thread to sleep. * Exceptions thrown by Thread.sleep() are handled here. This way, code calls to sleep() are cleaner. * @param millis - the length of time to sleep in milliseconds */ public static final void sleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Because if sleep throws that exception, the thread is no longer interrupted } } }