search
HomeJavaJavaBaseWhat are the characteristics of abstract classes

What are the characteristics of abstract classes

Jun 28, 2020 pm 03:35 PM
abstract classFeatures

The characteristics of abstract classes are: 1. Both abstract classes and abstract methods need to be modified with abstract; 2. There can be no abstract methods in abstract classes, but abstract methods must be in abstract classes; 3. Abstract classes cannot directly Create objects; 4. Abstract classes have construction methods.

What are the characteristics of abstract classes

Characteristics of abstract classes:

(Recommended learning: java entry program)

1 , both abstract classes and abstract methods need to be modified with abstract;

2. Abstract methods must be in abstract classes, and there can be no abstract methods in abstract classes;

3. Abstract classes cannot directly create objects. (Instantiation);

4. If a subclass of an abstract class overrides all abstract methods, it will be a concrete class;

(Video tutorial recommendation: java video tutorial)

5. If the subclass of an abstract class does not override all abstract methods, then the subclass is still an abstract class;

6. The abstract class has a construction method, which is intended to allow the subclass to To call the constructor initialization;

Code example:

abstract class Emoplyee {
String name;
public Emoplyee(String name) {
this.name = name;
}
public void test() {
}
public abstract void work();
// public abstract void sleep();
}
class Waiter extends Emoplyee {
public Waiter(String s) {
super(s);
}
public void work() {
System.out.println("我来搽桌子");
}
}

The above is the detailed content of What are the characteristics of abstract classes. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment