File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes delay some code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "delay some code" Watch "delay some code" New topic

delay some code

dale con
Ranch Hand

Joined: Apr 15, 2005
Posts: 93
hi all

can someone tell me the best way to wait, say 5 seconds before the next line of code executes


system.out.println("first line of code");

wait 5 seconds and run next line of code

system.out.println("second line of code after waiting 5 seconds");

Rajasekar Elango
Ranch Hand

Joined: Sep 13, 2004
Posts: 105

E. Rajasekar

SCJP 1.4
Stuart Ash
Ranch Hand

Joined: Oct 07, 2005
Posts: 637
This is a fairly fundamental concept in Java, something everyone is expected to know well about. You may want to spend some time reading about Threading. If you are a beginner just getting into Java, you will encounter this chapter eventually in your course.

All the best.

ASCII silly question, Get a silly ANSI.
I agree. Here's the link:
subject: delay some code
It's not a secret anymore!