java--Abstract class

Source: Internet
Author: User
Abstract classes and abstract methods
  • Abstract class:

Classes that are decorated with the abstract keyword are called abstract classes. An abstract class is a special class.

Definition syntax:

[Access modifier] Absrtact class class Name {[Class member]}

Description

The Absrtact keyword that is used to decorate the class. The class being decorated is called an abstract class.

Abstract and non-abstract methods can be included in an abstract class.

Application:

The implementation of the class as a template requires that the implementation in the child class be constrained.

  • Abstract methods

Overview:

The method of modification by the abstract broad-Jian character is called an abstraction method. An abstract method has no method body and can only be defined in an abstract class.

Grammar:

[Access modifier] Abstract return value type method name ([parameter list]);

Characteristics:

Abstract methods can only be defined in abstract classes

An abstract method has no method body and must be implemented in a non-abstract subclass

Role:

Constrain subclasses to improve extensibility.

java--Abstract class

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.