Java Web Learning path ------- object, constructor, Java Web -------
1. Object: abstraction in a field of Problem Determination
Properties: hidden, encapsulated, inherited, and Polymorphism
Encapsulation: it refers to the mechanism of bundling object state information (attributes) and behavior (methods) into a logical unit.
Hide: This feature protects the methods and attributes of an object. External programs cannot directly access the object.
Inheritance: the private attributes and methods of the parent class cannot be inherited, and only single inheritance is supported, but multiple implementations can be implemented.
2. abstract classes cannot create objects
3. when a subclass creates an object, it calls the constructor of the parent class (in the constructor of the subclass, the parent class is used to view how the constructor is defined), but the parent class object is not created.
4. Constructor (the compiler determines which constructor to call): it is best to explicitly write the constructor to facilitate program maintenance.
(1) Syntax:
① The name must be the same as the class name
② Constructor cannot have the concept of Return Value
(2) role:
Initializes the attributes of the specified object in heap memory.
(3) Number:
At least one
The compiler determines which constructor to call and which constructor to use based on the parameter list.
(4) If there is no custom constructor in the class, a default constructor is used,
However, if you define a constructor, no default constructor is available.
(5) permission for constructor can be private
(6) The constructor is called by a virtual machine.
5. The entity class generally does not have the main method. The main method is usually used in the test class.
In the test class, accessing the attribute methods in the object class in the test class depends on the attributes and method permissions of the object class.
6. Package Declaration: place the class bytecode in the corresponding directory structure of the package.
Package and compile: javac-d. name. java
Package import: Find the class
7. By default, the reference type is 4 bytes in the heap, and the default Initialization is null.
8. when an object is created, the attribute space, method space, and reference type space in the heap memory space are all 4 bytes in size, memory of other basic types divides the space size based on the data type.
9. Memory graph analysis: