Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7497683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:11:16+00:00 2026-05-29T19:11:16+00:00

Many articles I’ve read on the Net about Singleton design pattern mention that the

  • 0

Many articles I’ve read on the Net about Singleton design pattern mention that the class should override ‘clone()’ method and in it, throw ‘CloneNotSupported’ exception. Is this really necessary?

The clone() method by default is protected, so no class (except those in the same package) would be able to call it on that Singleton instance. Plus, if this Singleton does not implement Cloneable, then even if this method is called, it will give a runtime exception. Plus, the constructor being private, we won’t be able to subclass it and thus allow for its cloning. So should I still implement this advice for my Singleton classes?

EDIT: Just to clarify: I’m not looking for the best possible way to implement Singleton. I’m just asking about the validity of the advice mentioned above, w.r.t the ‘normal’ Singleton pattern (and not Enum based Singleton).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:11:18+00:00Added an answer on May 29, 2026 at 7:11 pm

    If you’re really going to implement a singleton, use a one-element enum and stop thinking about it.


    EDIT: Just to clarify: I’m not looking for the best possible way to implement Singleton. I’m just asking about the validity of the advice mentioned above, w.r.t the ‘normal’ Singleton pattern (and not Enum based Singleton).

    Since you have Effective Java, then you should already be aware of the pitfalls and problems with Cloneable. That said, if you’re going to implement a singleton one of the “wrong” ways, no, there’s absolutely no reason whatsoever to implement Cloneable and override Object#clone() just to throw CloneNotSupportedException. Object#clone() already does this when the Cloneable interface is absent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read many articles about known types and i belive my example should work.
I read many articles about unsafe functions like strcpy, memcpy, etc. which may lead
.Net MVC application also running Linq-to-SQL. I have seen many articles on grids that
Having read the documentation and many many articles I believe the following should work
I have read so many articles about integration and yet i did not found
In many articles, tutorials, docs, have read so far, that we call startService() or
i have read many articles that can be found on soap , i am
I have read many articles about vertical centering but I’m afraid not many of
I have read many articles about XML parsing in Android. However, all of them
I have read many articles about linq to sql performance. The result which i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.