What are static factory methods?

Posted by Jessica Taylor | Updated on

In this answer, I have shared what are static factory methods? We avoid providing direct access to database connections because they are resource intensive. So we use a static factory method getDbConnection that creates a connection if we’re below the limit. Otherwise, it tries to provide a “spare” connection, failing with an exception if there are none.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers