Possible Duplicate:
Why shouldn't C#(or .NET) allow us to put a static/shared method inside an interface?
Why we cannot define static method inside interface?
All methods in an interface are explicitly abstract and hence you cannot define them as static because static methods cannot be abstract.
Static methods in an interface since java8Since Java8 you can have static methods in an interface (with body). You need to call them using the name of the interface, just like static methods of a class.
Because interfaces are in inheritance structure, and static methods don't inherit well.
Default methods enable you to add new functionality to the interfaces of your libraries and ensure binary compatibility with code written for older versions of those interfaces. A static method is a method that is associated with the class in which it is defined rather than with any object.
From the top search result in Google:
Because an interface is a "contract" or an agreement between the consumer (caller) and the provider (callee). An interface describes what and how the calle will provide functionality. There is no need for static members provided by a third party. Static members cannot be overridden by a provider so they do not belong in an interface.
Stefan Rusek
08 February 2006
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With