Very simple question. Since constants are "public static final" .... What are your views?
K. Tsang OCPJP7 OCMJEA6
posted 8 years ago
The answer is as simple as your question:
Interface is a contract, If you want every class that implements this interface to have the constants, they should be in the interface else in implementing class.
"public Static final" : here, what I understand from your question is that you are concentrating on "public" part i.e. data is visible to everyone, but if you shift your attention to "final" part - no one will be able to change it. The only fundamental of having private data in a class is that no one can alter it in an inappropriate way(thats why you have getters and setters), but here it is "final"