Class PrivateInterfaceMethodExamples

java.lang.Object
net.jrodolfo.java_evolution.java09.PrivateInterfaceMethodExamples

public class PrivateInterfaceMethodExamples extends Object
Demonstrates private methods in interfaces, introduced in Java 9.

Java 8 introduced default methods, which allowed interfaces to provide behavior. The missing piece was private helper logic: without Java 9, common code shared by multiple default methods had to be duplicated or exposed as a public interface method.

Java 9 solved this by allowing private and private static methods in interfaces. Default methods can now share implementation details without adding those helpers to the public API.

  • Constructor Details

    • PrivateInterfaceMethodExamples

      public PrivateInterfaceMethodExamples()
  • Method Details