This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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!