Others
- Initialization blocks are executed in front of the constructor;
- Static initialization blocks and instance variables show the initialization execution order for each defined position;
- The final class cannot derive subclasses, the final method is not overwritten, and the final variable cannot be re-assigned;
- The decision value is equal, the string class has overridden the Equals method, and the Equals method of the other class needs to be rewritten in order to determine the value equality;
- The Singleton class, which creates only one object's class, hides its constructors with private adornments, the members and functions are decorated with static, and public static modifies the method to ensure that only one object is produced;
- Immutable classes: Once a class is created, its instance variable values are immutable: field is decorated with final and private, and avoids the provision of modified functions;
- Final modified class, no subclass;
- The final modified method is not overridable;
Abstract class
- Abstract methods can only be defined as abstract classes, abstract classes may not contain abstract method, abstract;
- Abstract methods and classes are modified by abstract, and abstract methods have no method body;
- Abstract classes cannot be instantiated and cannot be created with new;
- The constructor of the abstract class is not responsible for creating the instance, which can be provided to the subclass invocation;
- Play polymorphic characteristics, BaseClass Bc=new subclass (constructor);
- Abstract classes can contain common methods;
Interface
"8-20" Java Learning Note 02