Abstract classkeyword abstractAbstract classes are often used to characterize the abstract concepts of analysis and design of problem areas, and are abstractions of a series of concrete concepts that look different, but are essentially the same. Classes that are typically decorated in a programming statement are abstract classes. In Java, a class that contains abstract methods is called an abstract class and cannot produce an object. An abstract class is incomplete and can only be used as an inheritance. In an object-oriented approach, abstract classes are primarily used for type concealment and for roles that act as global variables.The above Baidu Encyclopedia of abstract class interpretation.
Understand the following abstract methods before learning abstract classes:
An abstract method is a method that is declared but not implemented, that is, a method that does not have any function code.
A typical abstract method is declared as follows
public abstract void Method ();
you can see that the abstract method does not even have the curly braces of the normal method, but ends with a semicolon. It can be seen from this that abstract methods are inherently used to inherit the main purpose of which is to declare methods, subclasses of non-abstract classes
Provide specific implementation code.
Note:
- Abstract methods can only be public protected if the private subclass cannot implement the parent class method, the abstract method has no meaning.
- Abstract classes cannot be marked as final because abstract must be inherited.
- The first non-abstract subclass of an abstract class must implement all its abstract methods.
- Abstract classes can never be instantiated.
Interface writing .....
Simple solution of abstract class and interface