Kindly explain me, what exactly author is trying to explain with example in the following paragraph
"Constructors can use any access modifier, including private. (A private constructor means only code within the class itself can instantiate an object
of that type, so if the private constructor class wants to allow an instance of the class to be used, the class must provide a static method or variable that
allows access to an instance created from within the class.)"
constructor is a special kind of method , you can specify an access specifier[what are all applicable to a method] to a constructor. so you can not access the *particular* constructor of that class[say class A] from other class[say class A]. and if you want to instantiate A from B then, provide a public method[Factory method] in A which create an object of A[private scope is available inside a class], and access the method from class B. this technique is useful in some core design pattern like singleton pattern, strategy pattern etc...