How to use Observer and Observable in Java?

How to use Observer and Observable in Java?


Two classes exist in java.util package to get informed whenever an object changes its properties. The class which you would like to observe (like a Student object) should extend Observable and the class which would like to keep a vigilance (like Principal) should extend Observer.

One program using both the classes with explanation is given in classes Observer and Observable.

Leave a Reply

Your email address will not be published. Required fields are marked *