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.


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.


Share this