001package headfirst.combining.observer; 002 003public class DuckCall implements Quackable { 004 Observable observable; 005 006 public DuckCall() { 007 observable = new Observable(this); 008 } 009 010 public void quack() { 011 System.out.println("Kwak"); 012 notifyObservers(); 013 } 014 015 public void registerObserver(Observer observer) { 016 observable.registerObserver(observer); 017 } 018 019 public void notifyObservers() { 020 observable.notifyObservers(); 021 } 022 023 public String toString() { 024 return "Duck Call"; 025 } 026}