Basic knowledge of Java 2

The main difference between a static method and a non-static method
1. When calling a static method externally, you can use the "class name. method name" method or the "object name. method name" method.
Non-static methods can only use the latter form, that is, calling static methods without creating objects.
2. When a static method accesses the members of this class, only static methods
are allowed to be accessed, and non-static methods are not allowed. There is no such restriction for non-static methods.
Coverage The
so-called coverage: the same method name, and doing different things on different occasions at that time. When a method in a subclass has the
same name, parameter and type as a method inherited from the parent class , it is said that the method in the subclass overrides the method in the parent class.
Similarly, if the subclass redefines the existing fields in the parent class, it is said that the fields in the subclass cover the fields in the parent class.
The difference between overloading and coverage
1. Method coverage is a matter between the subclass and the parent class, and belongs to a vertical relationship. Method overloading is a horizontal relationship between methods in the same class
.
2. Coverage can only have one method or a relationship can only be generated by a pair of methods; method overload is the relationship between multiple methods.
3. Coverage requires the same parameter list, and overload requires different parameter lists.
4. In the coverage relationship, which method body is called is determined according to the type of the object (the type of storage space corresponding to the object); the
overload relationship is determined according to the actual parameter list and the formal parameter list at the time of the call.
Abstract class
1, abstract class and abstract method must be modified with abstract keyword, otherwise the system will issue an error message.
2. The abstract class cannot be instantiated, that is, the new keyword cannot be used to produce no object.
3. The abstract method only needs to be declared, not implemented in this class, and needs to be implemented in subclasses (required).
4. A class containing abstract methods must be called an abstract class, and the subclass of an abstract class must cover all abstract methods before it can be instantiated,
otherwise the class is still an abstract class.
Construction method
1, the name of the construction method must be exactly the same as the name of the class.
2. The constructor has no return value
3. Although there is no return value, void modification cannot be used.
4. The construction method cannot be modified with static and final.
Dynamic webpages
Dynamic webpages refer to webpages that are interactive and whose content can be automatically updated, and will change according to the time of the visit and the visitor. The interactivity mentioned here means that the webpage can dynamically change or respond according to user requirements

Guess you like

Origin blog.csdn.net/qq_41827511/article/details/113366794