Originally posted by Paul Sturrock: I doubt if there would be any performance implications one way or the other. Placing constants in an Interface is supposedly frowned upon, but again I can't really see a reason why.
It is frowned upon basically for not using Interfaces for its intended purpose, but for side effect. That is for convenience it provides that you don't have to fully qualify the constants as compared to if they were in a class.
Typically we use interfaces so that the clients can work with interfaces rather than the classes implementing them, giving the flexibility of changing the implementations without having to change client code.
Joined: Jul 11, 2001
Placing constants into interfaces is not was is frowned upon, but inheriting them from an interface to use the constants inside a class is.
This is not a performance related, though, so I'm moving to Java in General (intermediate). It is a quite frequently asked question, by the way - a search should give you many interesting discussions on the topic.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus