aspose file tools*
The moose likes Beginning Java and the fly likes what are singleton classes in Java API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what are singleton classes in Java API" Watch "what are singleton classes in Java API" New topic
Author

what are singleton classes in Java API

sirisha makkapati
Ranch Hand

Joined: Dec 10, 2006
Posts: 83
Any one Please Tell me

what are singleton classes in Java API

Thanks
Sirisha
Guru dhaasan
Ranch Hand

Joined: Sep 13, 2006
Posts: 126

basically singleton class allows only one instance of the class to be created at any time


Thanks, Shiv
SCJP, OCE - JSP & Servlets Developer
David McCombs
Ranch Hand

Joined: Oct 17, 2006
Posts: 212
Are you asking what a singleton is or what classes in the API implement that pattern?

If the former, a search on this site should prove useful as it is a often talked about topic.

If the latter, look for a class with a private constructor AND has a static method named something like getInstance() or getNameOfClass. If a constructor is not shown in the API it is private.

A well known singleton is Runtime, but there are many more. Another possibility is MessageDigest. Although that one has a protected constructor, so I am not sure it can be considered a singleton. Anyone know?


"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Gurudhaasan",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

thanks,
Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what are singleton classes in Java API