[an error occurred while processing this directive]

Design Pattern



  1. Observer Design Pattern
    This design pattern defines one to many dependency between the objects so that if an object changes its state then all the dependent objects are notified and updated automatically. It is mainly used, to maintain consistency between objects, support to broadcast communication, to maintain classes for further use by making them loosely coupled, to make GUI application and many more. Java API provides a built-in Observable class and Observer interface.

    Here we are taking an example just to demonstrate that how observer pattern works, for this, the example creates two windows. The first window takes the input from the user and the second window displays this input. As soon as the data is entered in the textfield and enter button is pressed, the second window gets the message and displays it with a dialog. The example uses the private inner class.


Read more information at:



[an error occurred while processing this directive]