There must be a good reason why Java designers didn't allow any state to be defined in interfaces . Can you please throw some light on this aspect of design decision ?
Java Interface – Why State is Not Allowed
designjavalanguage-design
Related Topic
- C# Language Design – Why Doesn’t C# Have Local Scope in Case Blocks?
- C# Language Design – Why Does C# Not Allow Scope-Local Using Directive
- Java – Does an Interface really have no state or behavior
- Java – Why do “checked exceptions”, i.e., “value-or-error return values”, work well in Rust and Go but not in Java
Best Answer
An interface is a contract specifying what its implementer promises to be able to do. It does not need to specify state because state is an implementation detail and only serves to constrain implementers in how this contract is fulfilled. If you want to specify state you might want to rethink you use of interfaces and look at abstract base classes instead.