Java is an object-oriented language, Java object-oriented generally have three major characteristics: encapsulation, inheritance, polymorphism.
Encapsulation : It is the encapsulation of properties and methods into a class.
inheritance : As subclasses inherit some properties and methods of the parent class.
polymorphic: Just as a parent class has multiple subclasses of different characteristics.
Here I do not explain more, below I mainly explain an inheritance. Inheritance is a feature of OOP (object oriented), and Java only supports single inheritance (if you inherit two parent classes that have the same method, then you do not know the inheritance to that parent class, so Java only supports single inheritance). Inheritance is a feature of Java, so we use the class to inherit the Objict class, so we need the method of object class, such as ToString (), GetClass (), wait () ... So the classes we build have parent classes.
There are generally three kinds in Java:
Basic Class : That is, the general class (generally referred to as the class is the basic Class), is the object template, is a collection of properties and methods. You can inherit other basic classes, abstract classes, and implement interfaces.
abstract class : A class with an abstract method (the abstract method is that the method must be implemented by inheritance, itself defined, not implemented). Abstract classes can have one or more abstract methods, which are the excesses of basic classes and interface classes.
interface Classes : Generally called interfaces, all methods in the class are abstract methods, and the methods of the class themselves are defined not to be implemented.
Abstract class and interface A by the "abstract class + abstract class name" is defined by "interface + interface name", the interface of the method is an abstract method, and the abstract class has a part of the method is implemented by itself, some definitions are not implemented.
Encapsulating inherited polymorphism