Why are interface variables static and final by default?

Jothi picture Jothi · Mar 12, 2010 · Viewed 377.7k times · Source

Why are interface variables static and final by default in Java?

Answer

cherouvim picture cherouvim · Mar 12, 2010

From the Java interface design FAQ by Philip Shaw:

Interface variables are static because Java interfaces cannot be instantiated in their own right; the value of the variable must be assigned in a static context in which no instance exists. The final modifier ensures the value assigned to the interface variable is a true constant that cannot be re-assigned by program code.

source