Task: Create a class named ConnectionManager that manages a fixed array of Connection objects. A client programmer should not directly create Connection objects, but can only receive them using a static method in the ConnectionManager class. When the ConnectionManager class has run out of objects, it should return a null reference.
Here's what I got
public class ConnectionManager { private static Connection[] limitObjects = new Connection[5]; public static Connection getObject(){ return Connection.createNewObject(); } } class Connection{ private Connection(){} public static Connection createNewObject(){ return new Connection(); } } I just can’t figure out how to implement this. “ When the ConnectionManager class has reached its supply of objects, it should return the null reference. ”?.