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:
extending interfaces
Posted by tejinder singh on April 20, 2001 at 12:47 AM
> I have a Java Interface called Announcement which extends hi yes,extending an interface by another interface means all the methods defined in the extended interface now becomes a part of the interface that extends it.in case you do not override the methods of the extended interface in the class that implements this interface than that class has to be declared abstract.e.g public interface one { void show(); } public interface two extends one { void show1(); } class three implements two { //here we have to override both show and show1() public void show() { } public void show1() {} } but in this case of extending one interface by another make sure you are not creating methods of same signature but different return type. as if one has a method void show(); than two which extends one cannot declare int show(); tejinder > public interface Announcement extends Serializable > If I create other classes that implement Announcement, will > they also automatically implement the Serializable Interface? > What are the rules for extending interfaces?
Replies:
|