![]() |
Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
> An I nterface can extend more than one interface . What is the practical use of this ???? Actually you only extend classes and you can only extend (inherit from) one superclass in Java. An interface consists of abstract methods only (an abstract method has no code) and you write the appropriate code for each method in the interface, eg you must write an actionPerformed(ActionEvent) method if you inmplement the ActionListener interface. However, if you want to implement more than one interface you can, for example you may, in an application rather than an Applet, want to extend WindowListener AND ActionListener to react to action events and window events (but one interface is not, in any sense, extending another). Remember, you have not inherited any functionality from these interfaces, they don't really DO anything for you in the sense that, say, extending Frame provides methods you can use (setTitle, setSize and so on).
Regards Richard
Replies:
|
Sponsored Links
|