This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Marianne Rivera wrote: Does this mean that if I implement this interface, I automatically inherit also
Yes you are correct.
Remember, interfaces are not always used as "templates". If you want to define some constants, usually, interfaces are the way to go. Check out SwingConstants for example. It is an interface, and defines many constants used in the swing UI.
Every method declared in an interface is automatically public and abstract, and every field declared is automatically public, static and final.
Maneesh Godbole wrote:If you want to define some constants, usually, interfaces are the way to go.
Ugh, please no.
Joshua Bloch explains why constants interfaces are wrong in Item 19 of his Effective Java book (Item 17 in the first edition). If you want a single place for all your constants, a final utility class should be used. Basically exactly what is described in the book, but the class should also be final (you can't subclass it because the constructor is private; making the class final makes sense).
Sun have used this technique themselves as well, with java.sql.Types (although again, only implicitly final...)