RSS Forums RSS

countdown timer program

Please support our Java advertiser: Programming Forums
Reply
Posts: 25
Reputation: shubhang is an unknown quantity at this point 
Solved Threads: 0
shubhang shubhang is offline Offline
Light Poster

countdown timer program

  #1  
Nov 21st, 2008
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.
AddThis Social Bookmark Button
Reply With Quote  
Posts: 164
Reputation: orko is an unknown quantity at this point 
Solved Threads: 10
orko orko is offline Offline
Junior Poster

Re: countdown timer program

  #2  
Nov 21st, 2008
read documentation on System.out.println()
A Perfect World
Reply With Quote  
Posts: 25
Reputation: shubhang is an unknown quantity at this point 
Solved Threads: 0
shubhang shubhang is offline Offline
Light Poster

Re: countdown timer program

  #3  
Nov 22nd, 2008
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
Reply With Quote  
Posts: 1,036
Reputation: BestJewSinceJC is a glorious beacon of light BestJewSinceJC is a glorious beacon of light BestJewSinceJC is a glorious beacon of light BestJewSinceJC is a glorious beacon of light BestJewSinceJC is a glorious beacon of light 
Solved Threads: 120
BestJewSinceJC BestJewSinceJC is offline Offline
Veteran Poster

Re: countdown timer program

  #4  
Nov 22nd, 2008
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
Reply With Quote  
Posts: 1,036
Reputation: BestJewSinceJC is a glorious beacon of light BestJewSinceJC is a glorious beacon of light BestJewSinceJC is a glorious beacon of light BestJewSinceJC is a glorious beacon of light BestJewSinceJC is a glorious beacon of light 
Solved Threads: 120
BestJewSinceJC BestJewSinceJC is offline Offline
Veteran Poster

Re: countdown timer program

  #5  
Nov 22nd, 2008
Originally Posted by BestJewSinceJC View Post
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.
Reply With Quote  
Posts: 705
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 83
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: countdown timer program

  #6  
Nov 22nd, 2008
Originally Posted by shubhang View Post
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Views: 1473 | Replies: 5 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 10:02 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC