Java 9 Interface vs Class

前端 未结 5 990
春和景丽
春和景丽 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 02:57

    Private methods are not inherited by subclasses, so this feature doesn't affect implementation classes. I believe the private methods in interfaces allow us to share code between default methods.

    Java interfaces still cannot have non-static members. That's a big difference and not multiple inheritance IMO.

提交回复
热议问题