What is the purpose of the default keyword in Java?

后端 未结 8 790
别那么骄傲
别那么骄傲 2020-12-02 08:28

An interface in Java is similar to a class, but the body of an interface can include only abstract methods and final fields

8条回答
  •  忘掉有多难
    2020-12-02 08:59

    Default methods enable you to add new functionality to the interfaces of your apps. It can also be used to have a multi inheritance. In addition to default methods, you can define static methods in interfaces. This makes it easier for you to organize helper methods

提交回复
热议问题