Search code examples
javainterfacejava-8default-constructordefault-method

Why not default constructors in Java 8?


I read this question. The answer says that even in Java 8 (where we can have default methods in interfaces), we cannot have default constructors. And it says that it makes no sense.

Can someone explain why it doesn't make any sense or whatever the reason there is no support for default constructors in Java 8?


Solution

  • The main purpose of a constructor is to provide an instance of a defined type, which doesn't make sense on an interface, since the main purpose of an interface is provide contracts between the components in the code.

    As for default constructors, it really doesn't make sense, since a default method has logic, what kind of logic would you declare on a default constructor?