but what is the advantage of extending an interface and then implementing it as compared to a single interface having both the method .
Good question. Before going into detail about the design decisions you are asking about, let us understand that to design software effectively, the design must be based on actual requirements. It is the "requirements" that will mostly influence design decisions about doing things in a certain way.
To answer your question clearly, we would need some requirements. Then after analyzing the requirements, you would be able to determine the advantages on designing in this fashion.
Without requirements, I can give you some hypothetical scenarios to think about.
What if you did not have the ability to alter the base interface?
Interface is part of some required third-party code.
What if there are many interfaces that inherit from the base interface? The following would not make much sense:
Note, these are simple examples with only a single method in each interface. Other scenarios might include interfaces with 10 or 20 methods. It would not be good to copy and paste these method signatures all over the place (even though you certainly could if you wanted to). This is the difference between good and bad software design. Hence, interface inheritence. [ June 12, 2008: Message edited by: James Clark ]
in evolving software and design, i often perceive another reason when interface inheritance is used.
if things are evolving and you want to extend an interface by adding behaviour to it (interface requirements changed) it is often easier to just extend it instead of adding methods to existing interface. thus you don't affect client code which is still based on simple interface (by using or implementing it).
of course you could get to one point of a interface-extending-hell (very deep and wide hierachy). then you should consider to refactor.