Why doesn't Java allow private members in interface?

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

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

13条回答
  •  醉酒成梦
    2020-12-07 13:35

    In Java 9, private methods in interfaces are possible.

    Java 9 specifications

    The javac compiler team is pleased announce the availability of compiler support for private methods in interfaces beginning with 9 b54 build of JDK.

提交回复
热议问题