+ 1
How to make a clock in java
which change its time every second
3 Antworten
+ 1
create a loop that will go on until the program is executed.
use System.currentTimeMillis() to get the current time on your computer
use something like an if statement to check when that time has been passed by 1000 milliseconds, and every time 1000 milliseconds passes use a variable called seconds that will increment by one each time, this will create a timer.
You can System.out.println(), or display in a window, the number of seconds every time that number updates.
The source code would be pretty complex and take a while to program but I hope this gives you a good starting point!
0
theard.sleep(10) can be the alternative
0
I thought so