Interface Methods

Interface Methods

Whether we are declaring or not, every interface method is by default public and abstract

E.g

interface Interf {
   void m1(); // public abstract void m1()
}

public: To make this methods availability for every implementation class.

abstract: Because interface methods specifies requirements but not implementation.

Hence the following method declarations are equal inside interface

1. void m1()
2. public void m1()
3. abstract void m1()
4. public abstract void m1()

As every interface method is by default public and abstract the following modifier are not applicable for interface methods.

  1. private
  2. protected
  3. <default>
  4. final
  5. static
  6. strictfp
  7. synchronized
  8. native
Interface Methods
Scroll to top