![]() |
![]() |
![]() |
![]() |
![]() |
|
Consider, for example, the movie observer,
defined separately from the application class, as follows. As written, you
cannot even compile the definition, because the getMeter and
getMovie getters are defined in the MovieApplication class,
not the MovieObserver class.
import java.util.*;
public class MovieObserver implements Observer {
public void update (Observable observable, Object object) {
getMeter().setValue(getMovie().rating()); // BUG!
getMeter().setTitle(getMovie().getTitle()); // BUG!
}
}