1. Official feature
213:milling Project Coin
Support for private methods in interfaces is briefly in consideration for inclusion in Java SE 8 as part of the effort to add support for Lambda Expressions, but is withdrawn to enable better focus on higher priority tasks for Java S E 8. It's now proposed, that support for private interface methods be undertaken thereby enabling non abstract methods of a in Terface to share code between them.
2. Instructions for use
The methods in the specified interface in Java 8 can define static methods and default methods in addition to abstract methods. To some extent, the functionality of the interface is extended, and the interface is more like an abstract class at this point.
In Java 9, the interface is more flexible and powerful, and even the access modifiers of the method can be declared as private, and the method will not be part of the API you expose.
3. Examples of Use
Still Silicon Valley interviewer Song Hongkang
Links: Https://www.jianshu.com/p/ba217038abb4
Source: Pinterest
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
JAVA9 new Features--syntax improvements: private methods for interfaces