Multiple choice technology architecture

What Modifier needs to be added in order to make the below function as Singleton Class? ----------- -------- Connection getConnection() throws Exception{ return new Connection(); }

  1. private, final.

  2. protected, static

  3. public, static

  4. public, final.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

For a Singleton pattern, the getInstance() method must be static to be accessible without an object reference, and typically public to allow access. However, the code shown creates a new Connection() on every call, which violates Singleton principles - it should return the same single instance. A proper Singleton needs a private constructor and a static field holding the single instance.