Re: Singletons?

Mark Space <markspace@xxxxxxxxxxxxx> wrote in news:FEDjg.147331$F_3.107067

Hi all!

I'm trying out some new Java code. I was surprised to find that Java
doesn't allow the static keyword for classes. How was I to implement
singleton objects then? Well, a quick web search and I've got the
answer, but now I have a few other questions on the JVM and compiler.

Let's say I have a class entirely of static methods:

public class anAPI {
static void methodA {}
static void methodB {}

I don't know the answer to your questions, but you can sidestep the questions
by defining a no-argument constructor and giving it the "private" keyword.
This way, there is no way that this class can be instantiated unless one of
its own static methods does the deed. [Well, maybe there is a cheat via

Your questions are still valid, and I am interested in the answers myself.

Ian Shef 805/F6 * These are my personal opinions
Raytheon Company * and not those of my employer.
PO Box 11337 *
Tucson, AZ 85734-1337 *