Seetharaman Venkatasamy wrote:this question discussed many times here. Please, SearchFirst
sai rama krishna wrote:Methods declared in an interface are implicitly abstract methods. so, by definition, they do not define the implementation of the method.
Rajiv Rai wrote:Why static methods are not allowed in interfaces?
Winston Gutkowski wrote:I think (or I hope) that Rajiv's question is a general one, and it does have some merit (there's no particular logical reason I know of why an interface shouldn't be able to define a static method - indeed I believe some OO languages do allow it); it's just that you have a lot of other things to consider.
Matthew Brown wrote:If you're looking for a reason why one might choose not to allow it - I'd say that the point of an interface is to define a contract. And I'm having difficulty thinking of how a static method has a role to play in that.
Winston Gutkowski wrote:
There are several of us who think that, in theory, it would be no bad thing; but there are a lot of layers to consider - not the least of which is the behaviour of a class that implements two interfaces, both of which define the same static method.
Rajiv Rai wrote:
The above problem applies to normal non static methods also i guess.. A class can implement 2 interfaces both of which can have same method
Rajiv Rai wrote:So , is there any specific disadvantage or design consideration that interfaces
were not allowed to have static methods