Is an interface a class?

后端 未结 6 1221
醉梦人生
醉梦人生 2020-12-15 17:18

Is an interface a special kind of class or can you say that an interface isn\'t a class at all?

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 18:07

    An interface(is a group of related methods with empty bodies.) is just an interface. Its not a class(A class is the blueprint from which individual objects are created).

    notice that you define an interface like this

    interface Bicycle {....}
    

    and a class is defined like this

    class MyBMX implements Bicycle{...}
    

    So an Interface is an Interface and NOT a class

提交回复
热议问题