aspose file tools*
The moose likes Beginning Java and the fly likes Singleton class confusion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Singleton class confusion" Watch "Singleton class confusion" New topic
Author

Singleton class confusion

sriram varadharajan
Greenhorn

Joined: Jan 03, 2007
Posts: 9
// here is my singleton class.



//first and only instance of singleton /


//I am thinking this will be same instance as the first one.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Welcome to the ranch. Please UseCodeTags the next time you post some code. I've added them for you this time.


[My Blog]
All roads lead to JavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you run two different programs ? If so, the value of the singleton is not going to be persisted anywhere. When the first application ends, everything is gone. What you should try is :
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Singleton class confusion
 
Similar Threads
Can one object access the private variable of another object of the same class?
Javaprepare Question
Is it possible to clone this object?
Shadowing
singleton pattern