1

I am fully aware that a class cannot directly extend 2 classes, but to my confusion when investigating the JPA, I found this (In org.springframework.data.jparepository):

public interface JpaRepository<T, ID> extends PagingAndSortingRepository <T, ID>, QueryByExampleExecutor <T>

My first instinct is that it is extending 2 classes and it works, but after noticing that it is an interface I am not so sure.

For an interface does extending a class count as implementing it or passing the implementation off to the implementer, or are interfaces allowed to actually have multiple direct inheritance? What precisely were they doing in this case?

Chthonic One
  • 213
  • 3
  • 11
  • Extends in an interface means extending another interface, not a class. Your confusion arises from the belief that if you see the word extends, it means extending a class. – Mario Ishac Jun 07 '18 at 22:30
  • Thank you for your response. I must not have found that result because I was searing for multiple inheritance class, not interface. – Chthonic One Jun 07 '18 at 23:10
  • Yeah, classes can inherit multiple interfaces (through implements) and one class (through extends). Interfaces can inherit multiple interfaces (through extends) and no class (as they are interfaces, by definition they can have no implementations). – Mario Ishac Jun 07 '18 at 23:30

0 Answers0