This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi all, in singleton design pattern. We normally have a method call getInstance() which takes in no argument. I'm wondering is it ok to pass in a parameter, for eg. java.sql.Connection to retrieve record from the database?
You can do anything you want, but the normal purpose of the getInstance() method in a singleton class is to return an instance of the class. You then use that instance to call other methods of the class to do whatever processing you want.