0

Running Clock?

I'd like to make a running clock that changes in realtime in the output. I would imagine the program would have to rerun itself constantly?? Is that possible?

6th Jul 2017, 5:03 AM
Michael
Michael - avatar
2 Respuestas
+ 1
The program doesn't need to rerun itself. You would just need to use a loop that checks the time and updates the clock until the program is exited etc. There are many ways that you could do this. boolean exit = false; while(!exit) { // code here }
6th Jul 2017, 5:15 AM
ChaoticDawg
ChaoticDawg - avatar
0
Okay so that is working but because I'm using System.currentTimeMillis() to get the time it prints the time (hour,minute,second) 1000 times! Is there a different method to use to get the time or is there a better way to fix it?
6th Jul 2017, 5:38 AM
Michael
Michael - avatar