Interface Methods

Interface Methods

In this tutorial, we are going to discuss interface methods in Java. Whether we are declaring or not, every interface methods are by default public and abstract.

Java Interface Methods

E.g

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

public: To make these methods available for every implementation class.

abstract: Because interface methods specify requirements but not implementation.

Hence the following method declarations are equal inside the interface

void m1()
public void m1()
abstract void m1()
public abstract void m1()

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

  1. private
  2. protected
  3. <default>
  4. final
  5. static
  6. strictfp
  7. synchronized
  8. native

That’s all about Interface Methods in Java. If you have any queries or feedback, please write us email at contact@waytoeasylearn.com. Enjoy learning, Enjoy Java.!

Interface Methods
Scroll to top