added lab15 ex2

This commit is contained in:
2024-11-11 13:26:18 +01:00
parent b964385405
commit fa5b8bf520
6 changed files with 194 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
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);
}
}