is there a way to add a default constructor to an interface

前端 未结 5 1110
不知归路
不知归路 2021-02-14 12:09

With default methods now added to Java 8, is there any way to create a default constructor?

I\'ve tried:

public interface KadContent
{
    publ         


        
5条回答
  •  误落风尘
    2021-02-14 13:02

    Constructors are when the objects come into picture and the fact that a object for an interface cannot be constructed is SOUND, be it Java, C# or Java8

    So... if you have any functionality that you would want to define by default in the interface level, Java8 introduces the concept of Default Methods.

提交回复
热议问题