What is an Interface in Java?

 An interface in java is a blueprint of a class It has static constant and abstract method 

    The Interface in java is a mechanism to achieve abstraction  there can be only abstract methods. Int the java interface not method body .It is used to achieve abstraction and multiple inheritance in java.

     In other words you can say that interfaces can have abstract methods and variables It cannot  have  a method body

* Java interface also represent the  IS-A relationship

* It cannot be instantiated just like the abstract class

since java 8  we can have default and static methods in an interfaces 

since java 9 we can have private methods in an interface

 

Comments

Blogs