Home  |   STIU  |   WOW  |   SCJP  |   SCDJWS   |   JEE FAQ  |   About US  |  

FAQ
  Java FAQ
  JSP FAQ
  Servlet FAQ
 

Advertisement

XyzWs Java FAQ:
Why Interface is useful?


Printer-friendly version Printer-friendly version | Send this 
article to a friend Mail this to a friend


Previous Next vertical dots separating previous/next from contents/index/pdf Contents
Advertisement
XyzWs Java FAQ: Why Interface is useful?

Why Interface is useful?

In Java, an interface defines new a type including a set of unimplement operation on it. An interface defines a protocol of behavior that can be implemented by any classes.

A non-abstract class that implements the interface must implement all the methods defined in the interface. The interface presents what its methods are and leave how to do them to the implementation class. A same method in the interface can have totally different implementation in different classes. The interface provides a clearner separation of behavior and implementation.

Because the class must implement all the methods defined in the interface, any changes on the method of the interface will affect to all the classes that implements the interface.


Previous Next vertical dots separating previous/next from contents/index/pdf Contents

Support  | Feedback  | Help