Search code examples
javavariablesstaticprivate

A java class only with "private final static" variables.. Is it a good idea?


I just want to know, since I have a lot of private final static variables in my 3 classes, if It is a good idea to put them in just one classe like this :

public class Definicoes 
{
    /*
    * Definições da Janela de Jogo
    */

    public final static String nomeJanela;
    public final static short janLargura;
    public final static short janAltura;
    public final static byte tabLinhas;
    public final static byte tabColunas;
    static
    {
    nomeJanela = "JFindPairs - 0.3";
    janLargura = 480;
    janAltura = 480;
    tabLinhas = 4;
    tabColunas = 4;
    }

    /*
    * Definições do Tabuleiro e respectivas Cartas
    */

    public final static byte numeroCartoes;
    static
    {
        numeroCartoes = 16;
    }
}

Thanks in Advance for any help. Luis Da Costa


Solution

  • I would put them in one place if they all have to be the same. Otherwise, I would keep the constants where they are used.