The JavaTM Tutorial 摘录

Trail: Learning the Java Language
Lesson: Interfaces and Packages  

Definition:An interface is a named collection of method definitions, without implementations.

 how an interface differs from an abstract class?

  • An interface cannot implement any methods, whereas an abstract class can.
  • A class can implement many interfaces but can have only one superclass.
  • An interface is not part of the class hierarchy.
  • Unrelated classes can implement the same interface.
  • 你可能感兴趣的:(java,Class,interface,methods)