java - Does it make sense to override a method in an interface -


i have example interface , b. has (abstract) method called foo. b extends a.

it possible override foo in interface b @override, there situation makes sense? there nothing override, because both methods have abstract , have no body. guess there no situation makes sense, right?

so why possible override in interface?

one situation when want update javadoc documentation reflect more specific contract in method in subinterface, case collection#addall(collection) , list#addall(collection):

  • collection#addall(collection):

    adds of elements in specified collection collection (optional operation)...

  • list#addall(collection:

    appends of elements in specified collection end of list, in order returned specified collection's iterator (optional operation)...

a subinterface can add default implementation starting java 8.


Comments