Challenge A: Singleton pattern

A singleton is a design pattern that restricts the instantiation of a class to one object.

Use access modifiers to create a singleton class Logger. This Logger should:

  • Provide shared, public, global access to the single Logger object.
  • Not be able to be instantiated by consuming code
  • Have a method log() that will print a string to the console

results matching ""

    No results matching ""