Weather Station :

When the observer design pattern is used for the weather station, if there is an update, all the observers (Concrete Observer objects) are notified by using the Concrete Subject object. Also, new observers are added or removed by using the Concrete Subject object.

In the main class, the WeatherData object is created. Later, Concrete Observer objects such as CurrentConditionsDisplay, StatisticsDisplay, and ForecastDisplay are created with the WeatherData object passed as an argument in their constructors and these objects are added to the ArrayList variable of the WeatherData object. Calling the set method of the WeatherData object from the main class, necessary data are set, and make the update method with passing the Subject object parameter call. The variables of each Concrete Observer object are updated. By calling the detach method of the WeatherData object with passing the argument of a Concrete Observer object in the main class, makes the Concrete Observer remove from the ArrayList variable of the WeatherData object.