Access Modifiers Declaration in Java Interface Methods

Thu, Dec 12, 2019

Read in 2 minutes

Java 7 and lower version interfaces :

In java 7 and the lower version, the interfaces can have only abstract methods. You can use the “public ” access modifier for the abstract methods and if you didn’t mention any access modifier, it will be considered as public by default.

Java 8 Interfaces :

If two interfaces have the same default method and if the two interfaces are implemented by a class, the class should provide the implementation for the default method. Complier will force this.

Java 9 interfaces :

Java 9 can have private methods. With private methods, it can have default, static, abstract and private static access modifiers.

Difference between java 8 functional interfaces and abstract classes: