Can I use implements and extends at the same time?

后端 未结 2 1952
孤独总比滥情好
孤独总比滥情好 2021-01-02 05:54

Can i use the implements and the extends at the same time? Because I need to inherit something on the other class while i used implements on the same class.

         


        
相关标签:
2条回答
  • 2021-01-02 06:17

    You can only extend one class but you implements multiple interfaces as your need.

    0 讨论(0)
  • 2021-01-02 06:38

    Yes you can but you need to write your extends before implements:

    public class DetailActivity extends AppCompatActivity implements Interface1, Interface2

    Any number of interfaces can be implemented, if more than one then each needs to be separated with a comma.

    0 讨论(0)
提交回复
热议问题