WHY WE USE INTERFACES IN JAVA

Mayank Tripathi

Total Post:807

Points:4035
Posted by  Mayank Tripathi
 710  View(s)
Ratings:
Rate this:
  1. Mayank Tripathi

    Post:807

    Points:4035
    Why we use interfaces in java

    The interface makes it possible for a method in one class to invoke methods on objects of other classes, without the requirement to know the true class of those objects, provided that those objects are all instantiated from classes that implement one or more specified interfaces. In other words, objects of classes that implement specified interfaces can be passed into methods of other objects as the generic type Object, and the methods of the other objects can invoke methods on the incoming objects by first casting them as the interface type.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!