![]() |
Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
If you use lazy initialization - initializing a Singleton public static final Stack getInstance() > > public class Stack > public static final Stack getInstance() > Basically, you always retrieve the singleton instance of Stack by going like this in your code: > Stack theStack = Stack.getInstance(); > You use a static method, and the constructor is private so that other classes cannot instantiate it. The singleton instance is stored as a static reference. > Hope this helps. I realize it's being answered several years after the question was asked.
Replies: |
Sponsored Links
|