Why doesn't Java allow private members in interface?

后端 未结 13 1344
时光取名叫无心
时光取名叫无心 2020-12-07 13:11

Why doesn\'t Java allow private members in interface? Is there any particular reason?

13条回答
  •  遥遥无期
    2020-12-07 13:32

    As of Java 8, interfaces can have default methods, and as of Java 9, an interface is allowed to have a private methods which can only be accessed by default methods in the same interface.

提交回复
热议问题