Hi Robert,
the "standard answer" I guess: use the Singleton-Pattern (see "Design
Patterns" by Gamma, Helm, Johnson and Vlissidis) like this:
public class Gizmo {
private static Gizmo instance = null;
private Gizmo() {
}
public static Gizmo getInstance() {
if (instance == null)
instance = new Gizmo();
return instance;
}
}
and call Gizmo.getInstance() wherever you need it.
You do know that this is not really a Java-*Linux*-Question, right?
Stefan
- A Global instance ? Robert Simmons Jr.
- Re: A Global instance ? Stefan Bodewig
- Re: A Global instance ? Catalin Climov
- Re: A Global instance ? Paul Mclachlan
- Re: A Global instance ? Surjan Singh
- Re: A Global instance ? Peter Pilgrim
- Re: A Global instance ? Marc Slemko
- Re: A Global instance ? Armen Yampolsky
- Re: A Global instance ? Peter Pilgrim
- Re: A Global instance ? Marc Slemko
- Re: A Global instance ? Peter Pilgrim
PGP signature