Variable available thoughout java program (singleton)
<p>I need to set a boolean variable at runtime that can be accessed by any other class (without having to pass the variable around from class to class).  This variable will be a configuration setting, and will depend on some value set by the user at runtime.    </p>

<p>I suspect a singleton is the way to go, but having spent the morning reading up on it, I seem to find a lot of examples (&amp; arguments) on the best way to create them, without any mention of how to actually use them.  </p>

<p>Is singleton the way to solve this?</p>

<p>If so, can anyone provide an example of a singleton, that can have a boolean value set, that can be accessed statically from any other class?</p>

<p>EDIT: I'm such an idiot (totally overcomplicating the problem, and missing the simplest solution).  </p>

<p><code>public static volatile boolean yourBoolean;</code> Looks like it'll work perfectly</p>
