Object creation can be expensive in terms of processing time and memory utilization. While there are cases where multiple object instances are inevitable to getting things done, there are certainly cases where only a single instance of object is sufficient. For example, if your program is only going to access a single database instance, it suffice to dedicate a single object that manages database connection(s) to your database server. Other examples are objects used for logging messages, objects used for loading/saving configuration details, objects used for managing threads and objects used for managing access to shared hardware devices such as the printer.
Ever since I advanced beyond the “hello worlds” of Java, I had never stopped coding. This section is for documenting code usages that I had employed while solving the technological problems that I had encountered.