Countdown gives you a tiny terminal countdown.
Run Countdown with a number of seconds, and it counts down to zero.
Wait.
Watch the numbers drop.
Then you're done.
That's it.
$ java -cp target/classes io.javalabs.Main 5
5
4
3
2
1
🚀
Run it again:
$ java -cp target/classes io.javalabs.Main 10
10
9
8
7
6
5
4
3
2
1
🚀
And maybe:
$ java -cp target/classes io.javalabs.Main 3
3
2
1
🚀
You wait.
It reaches zero.
Then you continue.
- Run Countdown with a number of seconds.
- Countdown prints the current number.
- Waits one second.
- Counts down.
- Reaches zero. 🚀
- Java 21
Thread.sleep()- CLI
Compile:
mvn clean compileRun:
java -cp target/classes io.javalabs.Main 10Replace 10 with however many seconds you want.
Countdown is a tiny experiment with time, delays, and the terminal.
Give it a number.
Wait.
Watch it count down.
Run it.
Wait for zero.
🚀
Part of JavaLabs.io - a collection of small Java experiments built to turn random ideas into working code.