DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   countdown timer program (http://www.daniweb.com/forums/thread158818.html)

shubhang Nov 21st, 2008 1:42 pm
countdown timer program
 
Hi,
I am making a java program to make a countdown timer.
User enters time,then when time is up a message is printed.
How do I print the time on the same line?
Please tell me how to go about it.
Thanks.

orko Nov 21st, 2008 3:11 pm
Re: countdown timer program
 
read documentation on System.out.println()

shubhang Nov 22nd, 2008 12:42 pm
Re: countdown timer program
 
Sir,
I am new at java ,so I dont know where to look for it.
I searched my notes ,but didn't find anything.
Please tell me where to find it.
Thanks

BestJewSinceJC Nov 22nd, 2008 1:46 pm
Re: countdown timer program
 
Just use google. Type System.out.println() java, or you could also try Java IO. Also, an easy way to 'count' would be

// X
Thread.getThread().sleep(1000); //waits for 1 second.
//If you print out right here, you can be sure that the time is extremely close to 1 second from X

BestJewSinceJC Nov 22nd, 2008 2:48 pm
Re: countdown timer program
 
Quote:

Originally Posted by BestJewSinceJC (Post 742188)
Just use google. Type System.out.println() java, or you could also try Java IO. Also, an easy way to 'count' would be

// Read in the amount of time you want to wait in seconds, call it "time"
Thread.getThread().sleep(time * 1000); //waits for 1 second if time = 1.
//Print out the time you waited.

Edited.

stultuske Nov 22nd, 2008 3:23 pm
Re: countdown timer program
 
Quote:

Originally Posted by shubhang (Post 742148)
Sir,
I am new at java ,so I dont know where to look for it.
I searched my notes ,but didn't find anything.
Please tell me where to find it.
Thanks

you'll be able to find it in the basic Java resources: the api's


All times are GMT -4. The time now is 10:52 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC