1. The member variable is initialized automatically, but the local variable does not;
2. Equals passes the reference value, = = passes the address value; When an object is a reference type, it must be compared by using equals.
3. Inheritance: To realize the reuse of code, the inheritance relationship with a kind of verification idea, namely "is a", encapsulation and inheritance is to achieve polymorphism and preparation;
4. Combination and inheritance: A combination is a reference to another class in one class, generating an instance of another class that is displayed.
Inheritance simply inherits the variables and methods that are modified by the public and protected in the parent class, and is implicit.
The difference: the use of the combination can be used in another class of private variables and methods, and inheritance can not be used to the parent class of private variables and methods;
5. Polymorphism: Three prerequisites: Inheritance, override, parent reference to sub-class object;
A common protocol is defined by inheritance, which means that the parent class and the subclass have common methods and properties that can be used.
6. Reload: 1). The parameter list for overloaded methods must be different, the return value type can be the same or different, but the return value type is not judged as the method overload.
2). Overloading is an implementation that enables a class to operate on different types of data in a uniform way (a method of the same name).
That is, multiple functions with the same name exist at the same time, but the parameter type or number is different, and the method is called by the type and number of arguments passed in the method.
Which method is called specifically.
7. Rewrite: 1. When the subclass inherits from the same method as the parent class, enter the data, but to make a response different from the parent class, overwrite the parent class method.
That is, the method is overridden in a subclass-the same parameter, different implementations.
2. Defines the unique characteristics of subclasses.
8. Private proprietary property; protected family property; public property;
9. Static variables and member (instance) variables can be called in a member (instance) method, but static methods can not invoke member (instance) variables, only static variables can be called.
The life cycle of a static variable is longer than the life cycle of the instance variable.
Static usually modifies the method, and final usually modifies the global variable.
Java Basic Notes