Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

wait

LsnewtonLsnewton Member Posts: 18
Is there a command that will cause the program to wait for a certain amount of time? eg: a picture moves across the screen, waits 5 seconds, then moves back?

Comments

  • arb123arb123 Member Posts: 696
    : Is there a command that will cause the program to wait for a certain amount of time? eg: a picture moves across the screen, waits 5 seconds, then moves back?
    :

    You can use the Thread.sleep(int millis) call.
    [code]
    public class Wait {
    public static void main(String[] args) {
    int seconds = 5;
    System.out.println("Waiting: " + seconds);
    try {
    Thread.sleep(seconds * 5);
    } catch (InterruptedException e) {}
    System.out.println("Done");
    }
    }
    [/code]

    ---------------------------------
    [size=1](Its just my sig)
    HOWTO ask questions: http://catb.org/~esr/faqs/smart-questions.html[/size]

Sign In or Register to comment.