interface in java
An interface in java is a blueprint of a class. It has
-static constants and
- abstract methods.
The interface in java is a mechanism to achieve abstraction. There can be only abstract methods in 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 methods and variables but the methods declared in interface contain only method signature, not body.
Java Interface also represents IS-A relationship.
It cannot be instantiated just like abstract class.
Reference: https://www.javatpoint.com/interface-in-java
Comments
Post a Comment