2024-11-11 13:26:18 +01:00

16 lines
392 B
Java

package lab15_observer.ex2;
public class DigitalTimer implements TimerObserver {
private final MyTimer timer;
public DigitalTimer(MyTimer timer) {
this.timer = timer;
timer.registerObserver(this);
}
@Override
public void update(int hours, int minutes, int seconds) {
System.out.printf("Time: %02d:%02d:%02d%n", hours, minutes, seconds);
}
}