As the name suggests, the chain of responsibility pattern creates a chain of receiver objects for a request. This pattern decouples sender and receiver of a ask for based on type of relate for. This pattern comes under behavioural patterns.
In this instance, in general each sender contains orientation to another recipient. If one object cannot handle the request then it passes the same to the next sender and so on.
We have formed an abstract class Abstract Logger with a level of classification. Then we have formed three types of loggers extending the Abstract Logger. Each logger checks the level of message to its level and print accordingly otherwise does not issue and pass the communication to its next logger.
Create an abstract logger class.
Create real classes extending the logger.
Construct different types of loggers. Allocate them error levels and set next logger in each logger. Next logger in each logger represents the part of the sequence.
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.