Home > DeveloperSection > Interviews > What are interfaces in Java

Posted on    April-21-2015 2:22 AM

 Java Java  Interface 
Ratings:
 2 Answer(s)
  437  View(s)
Rate this:

Samuel Fernandes
Samuel Fernandes

Total Post:28

Points:140
Posted on    April-21-2015 2:22 AM

What are interfaces in Java ?

Mayank Tripathi
Mayank Tripathi

Total Post:807

Points:4035
Posted on    April-21-2015 2:59 AM

An interface in java is a blueprint of a class. It has static constants and abstract methods only.

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

Java Interface also represents IS-A relationship.It cannot be instantiated just like abstract class. 
A class can only implement interfaces

Uses:
It is used to achieve fully abstraction.
By interface, we can support the functionality of multiple inheritance.
It can be used to achieve loose coupling.

Don't want to miss updates? Please click the below button!

Follow MindStick