May be I am missing some understanding or may be I am unable to understand some "wording" (I am fairly new to JAVA and android), but if you look at the developer reference docs for android, then one can find that an interface is "implementing" another interface. For example, among others, look at ComponentCallbacks2 & SurfaceHolder.Callback2. But, as per an SO post, an interface cannot implement another interface, it can only extend one. So, what is going on in the android reference docs? Shouldn't the keyword "extends" be used in the android reference docs, instead of "implements" when it comes to relationships between interfaces?
Also, say an interface interfaceB
implements another interface interfaceA
and a class, say ClassXYZ
, implements interfaceB
. While declaring the class in the reference docs, sometimes it is mentioned as:
public class ClassXYZ implements interfaceB
(for example, in the declaration of Activity, it is mentioned that Activity class implements ComponentCallbacks2
, but it is not mentioned that Activity implements ComponentCallbacks even if ComponentCallbacks2 "implements" ComponentCallbacks2)
and sometimes as
public class ClassXYZ implements interfaceB, interfaceA
(for example, in the declaration of AlteredCharSequence, it is mentioned that AlteredCharSequence class implements CharacterSequence, and it is mentioned that AlteredCharSequence implements GetChars even if GetChars "implements" CharSequence)
What is the difference between the two declarations? How does the class inheritance diagram look in both the cases?