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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help....." Watch "Need help....." New topic
Author

Need help.....

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Ho dear Friends,
I don't understand what is the second line for?could you please help me to describe second line?
Many thanks,
Elahe
---------------------------
public class DbManager {
private static DbManager oSingle = null;


Thanks,
Elahe
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

that's the start of a Singleton pattern.
This ensures that only a single instance of this class is possible.

Because the constructor is protected (or private), code using this class cannot do this:The user of this class is forced to use the static method that gets the internal instance. The internal instance is also declared static, because the static method needs access to it.In this case, both one and two refer to the same instance, and not two different ones.
[ March 01, 2002: Message edited by: Mike Curwen ]
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Moving this from Servlets -> Java in General (Beginners)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help.....
 
Similar Threads
Class Diagram Question
what is wrong with my code?.
DB Reader Pooling
java.sql.SQLException: Server configuration denies access to data source
Singleton Connection Class