// Project: Observer // Module: messageboard1 // Source code file: Main.java // Illustrate the Observer software pattern. // Student is the observer; // MessageBoard is the observable. public class Main { public static void main(String[] args) { // Test the Observer and Observable classes. MessageBoard board = new MessageBoard( ); Student bob = new Student("Bob"); Student alice = new Student("Alice"); board.addObserver(bob); board.addObserver(alice); board.changeMessage("Homework 5 Description posted"); System.out.println("Number of observers: " + board.countObservers( )); } }