×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT技术讨论 / ask for help: What is the diffrence between an Abstract class and interface. I'm so sorry not tell the difference between them. thank you!
    • I have ever posted something about this problem here.
    • my limited understanding
      Abstract classes might include both clearly or not clearly defined methods. The inheritors of abstract classes will override or define these methods.
      Interfaces are kind of abstract class that contain no any clearly defined methods. it just provides a common frame for inheritors.
      • Does it mean: Abstract class can have some methods to be used directly by the object, comparing with Interface can have only method name, we must implement them before we use.
        • my understanding is it's more often to override methods of abstract classes instead of using it directly.. I'm also a java learner..
    • Notice that: you can inherite from only one class, but you could implement several interfaces. This might be the main point when you choose abstract class or interface.
      • I believe it's the point.
    • All the methods in the interface are implicitly abstract.
    • abstract class can have variable , normal method,etc; but interface can't. interface is kind of pure "abstract class".
      • I remember that Interface can have variable if it's Final Static.