Code example for Observable

Methods: addObserver

	private float temperature ;
	private float humidity;
	public CurrentConditionsDisplayUtil(Observable observable){
		this.observable = observable;
	public void display() { 
		// TODO Auto-generated method stub 
		System.out.println("Current Conditions:"+temperature +"F degrees and " + humidity +"%humidity");
	public void update(Observable obs, Object arg1) {
		// TODO Auto-generated method stub 
		if(obs instanceof WeatherDataUtil){
			WeatherDataUtil weatherDataUtil = (WeatherDataUtil)obs;
			this.temperature = weatherDataUtil.getTemperature();
			this.humidity = weatherDataUtil.getHumidity();
Stop searching for code, let great code find you!  Add Codota to your java IDE