Computer Science, asked by deepakkumar1282, 7 months ago

State need of interface with suitable example

Answers

Answered by syeedafirdose
4

Answer:It is used to achieve total abstraction. Since java does not support multiple inheritance in case of class, but by using interface it can achieve multiple inheritance . It is also used to achieve loose coupling. Interfaces are used to implement abstraction.

Explanation:please follow and mark as brainliest

Answered by KailashHarjo
0

The need of interface in any system is described below:

  • An interface establishes the capabilities of the classes. Every abstract method declared in an interface will have implementation when a class complies with the interface's requirements.
  • Interface identifies a collection of typical actions. These behaviors are accepted by the classes that implement the interface, and they offer their own implementation of the behaviors.
  • As opposed to the actual implementation, this enables you to program at the interface. An interface's primary function is to establish a communication contract between two objects.
  • Knowing that a class implements an interface means you are aware of the fact that the class has actual concrete implementations of the methods declared in the interface.
  • In other words, two objects can communicate based on the interface's contract rather than their own specific implementation.

To learn more about interface and its necessity, refer to these answers:

https://brainly.in/question/314316

https://brainly.in/question/18177097

#SPJ2

Similar questions