This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Singletons usually hold some state (variables) and you want to be sure there is only one copy in the JVM. Caches are good examples. I stuff data in there for use later because it's faster to use memory than a database or disk, and I want to be sure there is only one copy of the data.
Static methods often operate on the parameters only and don't use internal state. The Math class methods are good examples.
Sometimes we blend these things. For example static logger methods might use a singleton log formatter object.
Both Singleton and Static Method designs have some negatives. They often bind you closely to the implementing class, making it hard to subclass them or plug in different implementations. Look carefully for alternatives before you invest too much in these techniques.
Hope that helps! Wander down to the OO, UML, etc. forum for lots more conversation like this. [ July 14, 2005: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi