Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java pause 1 second

//deprecated in main thread:
try {
  Thread.sleep(1000);//time is in ms (1000 ms = 1 second)
} catch (InterruptedException e) {e.printStackTrace();}

//please use bellow instead:
Timer timer = new Timer();
timer.schedule(new TimerTask() {
  @Override
  public void run() {
    //what you want to do
  }
}, 1000);//wait 1000ms before doing the action
Comment

java sleep 1 second

import java.util.Date;
public class JavaHungry {
    public static void main(String args[]) {
      try
      {
        System.out.println("Start of delay: "+ new Date());
        // Delay for 7 seonds
        Thread.sleep(7000);   
        System.out.println("End of delay: "+ new Date());
      }
      catch(InterruptedException ex)
      {
          ex.printStackTrace();
      }
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java integer to binary string with leading zeros 
Java :: java get excectuon time 
Java :: cordova android.useandroidx 
Java :: open link in android studio 
Java :: will my java minecraft be discontinued 
Java :: Cannot resolve class android.support.design.widget.AppBarLayout 
Java :: simpleListView = (ListView) findViewById(R.id.simpleListView) explain 
Java :: add retrofit dependency android 
Java :: return boolean value from stream 
Java :: allow internet permission android 
Java :: bucket sort java 
Java :: how to remove all whitespace from string java 
Java :: java create a set with values 
Java :: How can I put a parameter into a localized string in Android? 
Java :: how to hide status bar in android studio kotlin 
Java :: how to disable screen rotation android studio 
Java :: java create txt file 
Java :: javafx icon button 
Java :: javafx listview get item index 
Java :: arraylist with values java 
Java :: java how to get elapsedTime 
Java :: sleep for milliseconds in java 
Java :: polar to cartesian java 
Java :: spring create bean only if another bean does not exists 
Java :: react native webview debug network 
Java :: execute application jar 
Java :: how to convert int to string java 
Java :: How to find a target value within a binary search tree, in Java? 
Java :: youTubeInitializationResult gives SERVICE_MISSING error in android 
Java :: android action key 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =