Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 9. Object-Oriented Techniques > Enforcing the Singleton Pattern

Recipe 9.10. Enforcing the Singleton Pattern

9.11.1. Problem

You want to be sure there is only one instance of your class in a given Java Virtual Machine.

9.11.2. Solution

Make your class enforce the Singleton Pattern (see Design Patterns, page 127), primarily by having only a private constructor(s).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint