0

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

4
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by alpe gulay
0

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!");

0

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)

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.