// Project: Observer // Module: messageboard1 // Source code file: MessageBoard.java // Illustrate the Observer software pattern. // Student is the observer; // MessageBoard is the observable. import it313.util.Observable; public class MessageBoard extends Observable { private String message; // When lastMessage is changed, it is added // to the message archive and all observers // are notified. public void changeMessage(String theMessage) { message = theMessage; setChanged( ); notifyObservers(message); } }