Home > DeveloperSection > Interviews > Why we use interfaces in java

Posted on    September-09-2015 6:46 AM

 Java Java  Interface 
 1 Answer(s)
  401  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Posted on    September-09-2015 6:46 AM

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.

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

Follow MindStick