Can a normal Class implement multiple interfaces?

后端 未结 8 1066
春和景丽
春和景丽 2021-01-31 01:34

I know that multiple inheritances between Interfaces is possible, e.g.:

public interface C extends A,B {...} //Where A, B and C are Interfaces

相关标签:
8条回答
  • 2021-01-31 02:38

    Yes, it is possible. This is the catch: java does not support multiple inheritance, i.e. class cannot extend more than one class. However class can implement multiple interfaces.

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

    An interface can extend other interfaces. Also an interface cannot implement any other interface. When it comes to a class, it can extend one other class and implement any number of interfaces.

    class A extends B implements C,D{...}
    
    0 讨论(0)
提交回复
热议问题