Observer pattern is use when there is one-to-many relationship between substance such as if one object is modified; its dependent objects are to be notified automatically. Observer pattern falls under behavioural pattern type.
Observer pattern uses three performer classes. Subject, Observer and Client. Topic is an object having methods to connect and detach observers to a customer object. We have created an conceptual class Observer and a concrete class Subject that is extending class Observer.
ObserverPatternDemo, our demonstration class, will use theme and concrete class object to show observer pattern in action.
Create Subject class.
Create Observer class.
Create concrete observer classes
Use theme and concrete observer objects.
Verify the output.
Design Patterns Related Interview Questions
|Java Script Interview Questions||AJAX Interview Questions|
|Graphic Design Interview Questions||Adobe Indesign Interview Questions|
|Java-Multithreading Interview Questions||Database Design Interview Questions|
|Compiler Design Interview Questions||CSS Advanced Interview Questions|
|Java Design Patterns Interview Questions||Hardware design Interview Questions|
|Material Design Lite Interview Questions||Object Oriented Analysis and Design Interview Questions|
|Standard Template Library (STL) Interview Questions|
Design Patterns Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.