Java - abstract

Q: So the question is, why do I have to use an abstract class? I direct the general category would still be able to achieve!

A: words to say yes, but the original intention of the abstract class is a reminder inherits its subclasses must implement the abstract method, which is a common method can not be done , because we may write the first one, the second of its when a subclass, but also knows it needs to write eat (), but written to the first 100 animals, but also to know? The abstract class can do reminders!


  • 9. Rules: access modifier can be used with any position before and after, not before and after the class keyword position swap.
  • 10. Modified: class, method.

Ps: Article 7 of the reason is that a few key words If there is no way to rewrite, which is contrary to the original intention of the abstract class!

Published 833 original articles · won praise 1674 · Views 780,000 +

Guess you like

Origin blog.csdn.net/Dream_Weave/article/details/105016857