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.

Recommended Answers

All 5 Replies

read documentation on System.out.println()

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

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

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.

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

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.