Question: Suppose I am reading a web page and the [URL](http://en.wikipedia.org/wiki/Uniform_Resource_Locator) is "<http://example.com/term/11,23>". How can I use [PHP](http://en.wikipedia.org/wiki/PHP) to get ONLY the integer in the URL?

Answer: 
Static variables are object-oriented substitutes for global variables in C. Try to avoid them whenever possible.

Many times you only need one object, in your case it's the Prefs object.

```
public class Prefs {

  //known before runtime
  public final String SERVER_BASE_URL ="http://api.mycompany.com/";

  //needs to be set on startup through the setter method
  private String token;

  public String getToken() {
    return token;
  }

  public void setToken( String token ) {
    Prefs.token = token;
  }

  public String getXyEndpointUrl() {
    return SERVER_BASE_URL + "/xy";
  }

}

public class Program {

  protected Prefs prefs;

  protected Other prefsAware;

  public Program() {
    prefs = new Prefs();
    prefsAware = new Other(prefs);
  }

  // or even (if you don't like constructor mediated passing of prefs)
  public Prefs getPrefs() {
    return prefs;
  }

}

```
typically global configs are read from properties files at runtime. You can have varying config files for the development, QA, production environments.

The only thing you need to at least be aware of is that in a web application, if you set static variables from a web request, you could munge the data if you do not synchronize the setter. If you are only reading then you should be fine. 

An alternative to what you are doing is why not inject the OAuth key into a service that handles the authentication concerns of your system? You could do what you need to do with a static resource, but in this case, but you should be aware that you don't really need a static variable to hold the key.