Basic Java Learning--abstract classes and abstract functions

Source: Internet
Author: User
Basic Java Learning--abstract classes and abstract functions
  • Abstract class
  • An abstract class cannot make an object, but a variable can be defined, and the object assigned to the variable must be a non-abstract subclass of it;
  • Abstract functions in abstract classes have no function body, for example: public abstract void Move ();
  • An abstract class can have no abstract method, and all methods have a method body, but the whole class is abstract.
  • All abstract functions in an abstract class must be overridden by a subclass, rather than an abstract function. Because subclasses inherit functions from the parent class, and if you do not overwrite the inherited abstract functions, the subclasses contain abstract functions, and the classes containing the abstract functions must be declared as abstract classes.
  • The design of such an abstract class is primarily to prevent the object from making it.

Basic Java Learning--abstract classes and abstract functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.