Re: Where do you keep contants in Interfaces or in classes?
- From: Lew <lew@xxxxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 06:31:24 -0400
Royan wrote:
So, I'm changing my previous decision to use interfaces as the place
to keep constants. Instead I will use the following approach:
package org.megaware.constants;
public final class Constants {
public final static int GENERIC_INT = 0;
// some other generic consts here
public final static class Network {
// some other Network consts here
public final static int DEFAULT_PORT = 55888;
}
public final static class Gui {
// some other GUI consts here
public final static String APP_TITLE = "Megaware";
}
}
You'll probably find it easier to maintain this code if you push your 'Network' and 'Gui' classes to top level instead of nesting them.
--
Lew
.
- References:
- Prev by Date: what is the meaning of stdio.h in ''c'' language?
- Next by Date: Index creation In Java
- Previous by thread: Re: Where do you keep contants in Interfaces or in classes?
- Next by thread: Formatting of strings
- Index(es):