Download Links, objects, object diagrams Section 7.8.1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Transcript
From Head First …
package headfirst.observer.weatherobservable;
import java.util.Observable;
import java.util.Observer;
public class StatisticsDisplay implements Observer, DisplayElement {
private float maxTemp = 0.0f;
…
public void update(Observable observable, Object arg) {
if (observable instanceof WeatherData) {
WeatherData weatherData = (WeatherData)observable;
float temp = weatherData.getTemperature();
…
display();
}
}
public void display() {
System.out.println("Avg/Max/Min temperature = " …
Sept 2005
92.3913
Ron McFadyen
6
Similar