Implements vs extends: When to use? What's the difference?

前端 未结 18 757
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 17:03

Please explain in an easy to understand language or a link to some article.

18条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 17:16

    • A extends B:

      A and B are both classes or both interfaces

    • A implements B

      A is a class and B is an interface

    • The remaining case where A is an interface and B is a class is not legal in Java.

提交回复
热议问题