Factory class in Java

This “Factory class in Java” page is providing clearly explains what are the rules we need to follow in the definition of FactoryClass with example code and how to access its functionality.

core-Java-online-Training-4

Factory Class :

  • Class must be public
  • Properties must be private
  • It is not allowed to instantiate the class directly(contains private constructor).
  • Using Factory method, we can get instance of this class.
  • “Factory method” is a static method available in factory class.
  • “Factory method” creates an object and returns from its definition.

core-Java-online-Training-4

Share this