Why do we need interfaces in Java?

Viewed 96714

In Java to implement multiple inheritance we use interfaces. Is it the only use of interfaces? If yes, what is the main use of interface in Java? Why do we need interfaces in Java?

6 Answers

We need interfaces :

  1. To achieve total abstraction.
  2. To achieve security.
  3. Java doesn't allow multiple inheritance but it can be achieved by implementing multiples interfaces.
Related