0 votes
in JAVA by
What is the interface?

1 Answer

0 votes
by

The interface is a blueprint for a class that has static constants and abstract methods. It can be used to achieve full abstraction and multiple inheritance. It 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 abstract methods and variables. Java Interface also represents the IS-A relationship. It cannot be instantiated just like the abstract class. However, we need to implement it to define its methods. Since Java 8, we can have the default, static, and private methods in an interface.

Related questions

+1 vote
asked May 5, 2021 in JAVA by SakshiSharma
0 votes
asked May 2, 2021 in JAVA by sharadyadav1986
...