The abstract class of Java learning

Source: Internet
Author: User

Use of the Java abstract class

When the same functionality appears in multiple classes, but the functional body is different,
This is available for upward extraction. At this point, only the function definition is extracted, not the functional body.

Abstract: Can not understand.

Features of abstract classes:
1, the abstract method must be in the abstract class.
2, both abstract methods and abstract classes must be decorated with the abstract keyword.
3, abstract classes can not create objects with new. Because it doesn't make sense to invoke an abstract method.
4, abstract methods in the abstract class to be used, the subclass must be replicated all the abstract methods, the child class object call.
If a subclass overrides only a subset of the abstract methods, then the subclass is an abstract class.


Abstract classes and general classes are not much different.
How to describe things, how to describe things, but there are some things that things do not understand.
These uncertain parts, and the function of the thing, need to be clearly present. However, the principal cannot be defined.
Represented by an abstract method.

Abstract analogies generally have multiple abstract functions. is to define an abstract method in a class.
An abstract class cannot be instantiated.


Special: Abstract methods may not be defined in a class, and this simply does not allow the class to establish an object.

The abstract class of Java learning

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.