USING AN INTERFACE TO HOLD CONSTANTS What happens if you want to group collections of constant values together but there's no obvious Class in which to put them? You should put them in an interface. Java interfaces are usually used for holding method signatures for implementing classes to obey, but they can also hold static final variables. An obvious example is when writing Internet service code. The Internet has a long list of common port numbers for different applications. Creating an interface called InternetServices provides a place to store all these port numbers. public interface InternetServices { static public int FTP = 21; static public int HTTP = 80; static public int TELNET = 24; static public int SSH = 22; static public int SMTP = 25; static public int POP3 = 110; .... } Developers may be tempted to name the interface something like Inet to make the typing easier. As always, that is a bad. In fact, a pleasant side effect of using an interface for constants helps make it unnecessary. If a class is a frequent user of the constants, then it can implement the interface and directly use the constants. For example: public class InternetServer implements InternetServices { private port = HTTP; // by default ... } Using an interface in this way stops them from being spread across many classes and helps manage a project's constants. The only caveat is that Java Naming Standards frequently ask that the interface name be pluralized, thus making it more obvious when an interface is a constants container. ----------------------------------------