The Java equivalent of global variables is to create a public class that has a set of public variables set to the appropriate values. These variables are accessed using the normal "class.variable" syntax. Normally all the methods that work on variables would be in the class.

A good example of the sensible use of such "pseudo global" variables is a "configuration" class. This could contain all the public variables, plus an "initialise()" method that sets up the starting values (read from a file etc.). The class could also contain any debugging or conversion routines required.

Global constants are handled in the same way, except that the variables will be "public final", and initialised in the declaration.