Question: Hello, I need some help modifying this java file to generate not one single object, but a specified amount of objects like 10. public class
Hello, I need some help modifying this java file to generate not one single object, but a specified amount of objects like 10.
public class Singleton { /** The reference to the unique instance of the class */ private static Singleton theSingleton;
/** * Private constructor
* Instances of this class cannot be created directly by calling the constructor. */ private Singleton() { System.out.println("Singleton constructor called ... "); }
/** Overrides Object's toString() */ @Override public String toString() { return this.getClass().getName(); }
/** * Accessor class method responsible for creating and maintaining an unique * instance */ public static Singleton getSingleton() { if (theSingleton == null) { theSingleton = new Singleton(); } return theSingleton; } }// end class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
