Looking on the Java Website it says:
In the Java programming language, an interface is a reference type, similar to a class, that can contain only constants, method signatures, and nested types. There are no method bodies. Interfaces cannot be instantiated—they can only be implemented by classes or extended by other interfaces
The pertinent bit of the above quote is where it mentions constants.
If in your interface you didn't use 'final' then it would be possible to change the value of the object when ever you felt like it, therefore you would be storing a variable rather than a constant.
I know that interface can contain only constant that's why we make variable as static final. My question is why only contants are allowed.
therefore you would be storing a variable rather than a constant.
I am afraid I couldn't understand your above above mentioned statement.
Use interfaces only to define types
means if want to force user to do something which will be helpful for user only or to stenderzie the code for all we will develop interfaces.
so anything we will write inside the interface is to provide flexibility for the users at the same time to maintain uniqueness among the code we have the things inside the interface which user can user for flexibility but can't modify to achieve the uniqueness in the code architecture.
so because of this only by default member variables are final in an interface...
you can use but can't be able to change the value.....
interfaces are something like propretry softwares you can use the things but can't change the things.