Object-oriented:
1. Object: Everything is Object, the object is caused by concern.
2. Class: Is an abstraction of an object.
3. Attribute: Is the value data of the object. 4. Behavior: Is the function of the object. Features: 1: Simplify complex things. 2: Object-oriented converts the performer in the previous process into a conductor. 3: Object-oriented This idea is in line with the current thinking habits of people. Access Modifiers: There are 4 modifiers: private, default, Protcter, public. Optional modifier now learns 4 overloads of the:static,abstract,final,default method: definition: In a class, multiple methods have the same method name, but the parameter list is different. Parameter list: Refers to the number of parameters, parameter types, parameter order of the different. Note: 1. Overloads must be overloaded by different parameter lists. 2. You cannot overload by using access, return type, or throwing an exception. 3. You can have different access modifiers. Rewrite of the method: definition: In inheritance, subclasses inherit methods from the parent class. However, subclasses need different implementations of the parent class, and the method implementation that extends or overrides the parent class needs to be re-written. This is the rewrite of the method. Overrides occur in an inherited class. Note: 1. The parameter list of the subclass, the method name must be exactly the same as the parameter list method name of the parent class. 2. The return type must be consistent. 3. The method modifier must be greater than or equal to the method modifier of the parent class. 4. Subclass overrides cannot throw more exceptions than the parent class is overridden by the method. Encapsulation (one object-oriented feature): Refers to the properties and implementation details of hidden objects and provides public access only externally. Benefits: Isolation of changes, ease of use, improved reusability, and security. Encapsulation principle: To hide the content that does not need to be provided externally, to hide the attributes, and to provide public methods to access them. This: Represents the object, which is the reference to the object to which the function belongs. Inheritance: definition: The relationship between classes and classes, with the same properties and behavior extracted, designed as a parent class. Subclasses can automatically have the properties and behavior of the parent class through inheritance. Keywords: Extend advantages: 1. Increase the reusability of the code. 2. Scalability has also increased. 3. The design program becomes simple. Note: 1.java is a single inheritance. (The class hierarchy is clearer, but the richness is missing) 2. The object class is a superclass of all classes, including arrays. 3. The implementation of the inheritance is implemented by means of a memory overlay. (First create parent object part, recreate subclass object part) 4. When subclasses need to re-implement the behavior of the methods in the parent class, they need to use the override of the method. polymorphism: definition: The same behavior, different implementations. --------for method polymorphism. Classification: Static polymorphism, and dynamic polymorphism. Type conversions: 1. Turn up:Assigns the object of the class to a variable of the parent class. (must be successful) 2. Turn down: Assigns the value of the parent class (reference value) to the variable of the child class. (not necessarily successful): The keyword instanceof is used to determine whether the preceding variable is pointing to the following type. Polymorphic Self-understanding: that is, in the method, you need to enter an object. But who the object is, does not know. You need to use the parent class to define one as the parameter passed in method. If you need to determine exactly which object, you need to use instanceof to invoke the object's unique method. If you are a method in a parent class, you can invoke the method you want to invoke directly with the parameter object defined by the parent class. This and Superthis: All the properties and methods in this class, you can see that inheriting the access modifier with the parent class allows you to see that the 2.this () represents other constructors that call the same class. Note: This () can only be placed in the first sentence of the constructor. Uper:1.super () invokes the specified construct of the parent class, which can only be placed in the first sentence of the constructor, and this () cannot occur at the same time. 2.super () has default, does not write (call parent class no parameter), this () does not have default. 3.super.****** the parent class object of the current object, accessing any properties and methods not defined by this class can also see inherited properties and methods of the parent class, as well as the access modifier restrictions, and this is the same. In summary: Super can see that this can also be seen. This is not necessarily a good view, so this is better. Abstract Classes: Classes that have abstract methods must be abstract classes. (in the Declaration section of the class, add abstract) Features: 1. Cannot produce an object. (Reason: The object is a concrete, actual existence, there should be no uncertainty.) 2. The meaning of the existence of abstract classes is to produce subclasses. 3. There are also attribute methods in the abstract class, and so on a class that has all of them. 4. Syntactically: Abstract classes can have no abstract methods, but this loses the meaning of design. 5. Abstract classes can inherit from abstract classes. 6. Constructor methods can be overloaded in abstract classes. Note: Subclasses inherit abstract classes, and all abstract methods in the abstract class must be implemented, unless the class is also an abstract class. Abstract is for classes and methods only. Usage: Generally used in the parent class, all child classes common, to be rewritten, is generally written as an abstract method, natural parent class is abstract class. In the code: @overriding can be labeled as a reminder. Interface: Features: 1. Is a separate data type. 2. The interface is concerned with the sharing of behaviors (interfaces cannot produce objects) 1> definition 1. Keyword: interface2. Interface syntax access modifier only public and default property: Can only be public, static, constant property (three must be satisfied) even if you do not write the STATC final, the default is also a constant. Construction: Interface no construction method. Method: The method defined in the interface can only be a public, abstract method. Ublic abstract can be omitted without writing. There are no instance initialization blocks, and there are no static initialization blocks. The name of the public excuse must be consistent with the Java file name where he resides. Note: In jdk1.8, the interface has a new function, that is, the ability to write the method implementation part. Decorated with default. java 5 pieces of memory. 1: Register. 2: Local method area. 3: Method area. 4: Stack. 5: Heap. Stacks: Stores are local variables (variables defined in functions, arguments on functions, variables in statements), and the data is freed as long as the area where the data operation is completed ends. Heap: Used to store arrays and objects, that is, entities. What is an entity? is used to encapsulate multiple data. 1: Each entity has a memory header address value. 2: Variables in heap memory have default initialization values. Because the data types are different, the values are not the same. 3: Garbage collection mechanism. The difference between a member variable and a local variable: 1: The member variable is defined directly in the class. A local variable is defined in a method, on a parameter, in a statement. 2: Member variables are valid in this class. A local variable is valid only within the curly braces it belongs to, the curly brace ends, and the local variable loses scope. 3: Member variables exist in heap memory and disappear as objects are created. A local variable exists in the stack memory and is released as the owning region runs and ends. constructor: Used to initialize an object, it is to initialize the corresponding object, it has pertinence, one of the functions. Features: 1: The name of the function is the same as the name of the class in which it is located. 2: You do not need to define a return value type. 3: The function does not have a specific return value. What is the difference between a constructor and a general function? 1: Two function definition formats are different. 2: Constructors are called when an object is created, used for initialization, and initialization actions are performed only once. The general function is that after the object is created, it needs to be called to execute and can be called multiple times.
Javaoo An important point of knowledge summary