------<a href= "http://www.itheima.com" target= "blank" >java training, Android training, iOS training,. NET training </a>, look forward to communicating with you! -------
Java object-Oriented Programming Learning Summary:
Important points of knowledge are summarized as follows:
1, abstraction, encapsulation, inheritance, polymorphism are the four characteristics in object-oriented programming.
2, object-oriented software development is broadly divided into: object-oriented Analysis, object-oriented design, object-oriented implementation.
It can be summarized as follows: Analyzing user requirements, extracting object models from problems, refining models, designing classes, including properties of classes and inter-class
Relationships, while observing whether there are existing classes or parts that can be directly referenced; Select an object-oriented programming language, the specific encoding implementation
The design of the previous stage class and the introduction of testing in the development process to improve the entire solution.
3, the advantages of object-oriented programming approach are: reusability, extensibility, manageability.
4, class definition: The modifier before class is divided into two categories, access control and non-access control. The access control includes public and private.
Non-access controls include abstract (abstract), final (final).
The 5,final class is the final class and is a class that cannot have subclasses. Abstract and final cannot modify a class at the same time because the abstract class itself has no concrete object.
The object that needs to be derived from the subclass after the child class is created. The final class cannot have subclasses.
6, the object is created in the format: Class name Object Name =new constructor method (parameter); Notice that the preceding class name is the constructor method.
Note that the constructor method has no return type and cannot write void, and is mainly used to complete initialization of class objects, and cannot be directly programmed
Called directly, but is called with the new operator.
7, if the class is preceded by the public modifier, the default constructor method should also have the public modifier before it.
8, the class has a static decorated domain or method that can be accessed using the class name or object name, or only by object name.
9, the access control for the modified domain can be: public,private,protected,private protected. The non-access control character can be:
Static,final,volatile (volatile domain)
10, the most essential characteristics of class variables are: They are the domain of the class, A specific object instance that does not belong to any one class. is not stored in the memory space of an object instance, but is stored in a common storage unit in the memory area of the class. 11, local variables are declared within the method body, and they exist only when the method is called, and therefore can only be used within this method, no access control, or static variables (static), but can be declared as a final variable. Local variables must be initialized.
12, the access control of the modifier method can be: Public,private,protected,private protected, the non-access control of the adornment method can be: static,final,abstract,native (local method), Synchronized (synchronous method).
13, variables or methods that are modified with static are class members, and class members can be accessed with the class name or instance name, and the instance members can only be accessed with the instance name.
14, if a class contains an abstract method, the class must be an abstract class, and if the subclass of the abstract class is not an abstract class, the subclass must implement all the abstract methods of the parent class. Abstract methods cannot be used with static methods and final methods. The only way to do this is to declare the function header, instead of using a semicolon to replace the method body with no curly braces. such as the abstract void Abstractmethod ();
The 15,this variable is used inside a method, pointing to the current object, and the current object refers to the object that invokes the currently executing method. The super variable is a constructor that points directly to the parent class and is used to refer to the variables and methods of the parent class. (because they refer to objects, they cannot be used to refer to class variables and class methods)
16, if you want to refer to multiple classes in a package, you can use asterisks instead. You can use asterisks to represent all classes at this level, not classes under sub-hierarchies. So it is often necessary to use two statements to introduce two levels of class: Import Java.awt.*;import java.awt.event.*;
17, Access modifier:
--members that are qualified as public in a class can be accessed by all classes.
--The members of the class that first locate private can only be accessed by the class itself. Different objects of the same class can access the other's private domain variable or call the other's domain method, because Access protection is controlled at the level of the class, not at the object level.
--a member of a class qualified as protected can be accessed by the class itself, its subclasses (including subclasses in the same package and different packages), and other classes in the same package.
--members decorated with private protected can be accessed by the class itself, or by all subclasses of the class.
--The default access control specifies that only classes in the same package can be accessed and referenced, but not by the classes of other packages. That is, his access rights are friendly.
18, note:
----abstract and private,static,final,native cannot be decorated the same way in parallel.
----fields and methods in an abstract class that cannot have private adornments
----The static method cannot handle non-static domains.
19, the parameters of the overloaded method must be different, or the number of arguments is different, or the parameter types are different. Overloaded multiple methods must return the same data type.
20, in Java, a class that acquires the functionality defined by an interface is not implemented by directly inheriting the properties and methods of the interface. Because the properties in an interface are constants, the methods of an interface are abstract methods that do not have a method body, and do not have a specific definition operation.
Dark Horse Programmer-java Object-oriented Programming learning summary