I'm wondering what would be most likely to be use, Is it interface Constants
or class Constants
?
I have a code that has an interface
like this:
public interface IConstantsVariableSupport {
public String URL = "www.sample-me.com";
public Integer LIMIT = 50;
}
This interface
will support all the class
that required its property constants. And I think that I can do it in a class
also with constants in it like this:
public class ConstantsVariableSupport {
public final static String URL = "www.sample-me.com";
public final static Integer LIMIT = 50;
}
So my question is, What is the approach I will consider when using to support other classes with the constants
they have. Is it using interface
or a class
? Or if likely, Can you suggest a best practice to handle a constant values for ease of use in the entire program. FYI I know how to use that two approaches, im just wondering how to do it right.