can anyone help me with this one...

System.out.println("Hi!");
System.out.println("How are you there!");

-can i display this one controlling the time!
what i mean is..
display first the "Hi!"
and then after 3 seconds it will display "How are you there!"

Help me pls..

ANY HELP IS HIGHLY APPRECIATED

-alpe

Recommended Answers

All 4 Replies

Yes you can use timing to pause inbetween.
use the code below to have 3 seconds delay.

System.out.println("Hi!");
Thread.sleep(3000);
System.out.println("How are you there!");

Just an addition to mukulbhave's post
Thread.sleep is in milliseconds to convert seconds to milliseconds

seconds x 1000

(Just incase you didn't know)

You should put Thread.sleep(3000); in a try catch statement because it throws an InterruptedException.

.,thnx a lot guys!:)
I got it already.,...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.