In Null Object pattern, a null object replaces check of NULL object instance. In its place of putting if check for a null value, Null Object reflects a do not anything relationship. Such Null object can also be used to provide default behaviour in case data is not accessible.
In Null Object pattern, we construct an abstract class specify different operations to be done, concrete classes extending this class and a null object class provide do nothing implementation of this class and will be used seamlessly where we need to verify null value.
We are going to produce conceptual Customer conceptual class essential operations. Here the name of the customer and concrete classes extending the Abstract Customer class. A factory class Customer Factory is produced to return either Real Customer or Null Customer objects based on the name of client passed to it.
NullPatternDemo, our demo class, will use Customer Factory to show the use of Null Object pattern.
Create an abstract class.
Create concrete classes extending the above class.
Create Customer Factory Class.
Use the Customer Factory to get each Real Customer or Null Customer substance based on the name of client passed to it.
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.