import java.util.concurrent.TimeUnit;
public class Click {
private Display hour = new Display(24);
private Display minute = new Display(60);
private Display second = new Display(60);
public void start(){
while(true){
second.increase();
if(second.getValue() == 0){
minute.increase();
if(minute.getValue() == 0){
hour.increase();
}
}
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.printf("%2d:%2d:%2d \n", hour.getValue(), minute.getValue(), second.getValue());
}
}
public static void main(String[] args){
Click click = new Click();
click.start();
}
}
package work10clock;
public class Display {
private int value;
private int limit;
public Display(int limit){
this.limit = limit;
}
public void increase(){
value++;
if(value == limit){
value = 0;
}
}
public int getValue(){
return value;
}
}
package work10clock;import java.util.concurrent.TimeUnit;public class Click { private Display hour = new Display(24); private Display minute = new Display(60); private Display second = new Dis...