Java 9 Interface vs Class

前端 未结 5 1003
春和景丽
春和景丽 2020-12-08 02:11

As Java 9 is going to allow us to define private and private static methods too in interfaces, what would be the remaining difference in inte

5条回答
  •  太阳男子
    2020-12-08 03:00

    Java Interface in version 9 have private methods but static private. The feature has been introduced to allow modular methods. One function should work with one responsibility instead of using lengthy default methods. It has nothing to do with multiple Inheritance. The more private static methods, the more you will be able to write the clean and reusable code. Anyways, static methods whether public or protected can not be overridden.

提交回复
热议问题