[java] Global variables in Java

Nothing should be global, except for constants.

public class MyMainClass {
    public final static boolean DEBUGMODE=true;
}

Put this within your main class. In other .java files, use it through:

if(MyMainClass.DEBUGMODE) System.out.println("Some debugging info");

Make sure when you move your code off the cutting room floor and into release you remove or comment out this functionality.

If you have a workhorse method, like a randomizer, I suggest creating a "Toolbox" package! All coders should have one, then whenever you want to use it in a .java, just import it!