Object-oriented Basic concepts
The object is essentially: attribute + behavior
Class:
-----class is a collection of objects that have common properties and behaviors
-----class defines the properties and methods of an object
-----can instantiate multiple objects of this class through a class, each object has a different property value, which can be said to be similar to a design drawing, and the object is like a multi-storey building built out of drawings.
-----class is the basic constituent unit of a Java program
Object-oriented:
Object-oriented refers to the analysis, design and implementation of the system with the object as the basic unit.
Basic structure of Java class
Structure of the class:
----attribute: Description of the object data;
----Method: The behavior of the object; (things you can Do)
----Construction method: Used to instantiate the object;
----Inner class: (inner Class) is the class declared in the class body.
----BLOCK: Divided into static block, instance block
Declaration form and function of class
Declaration form of a class
Class Name {
Class Body
}
Class: A class is a template that defines properties and methods common to multiple objects
Declaration form and function of attribute
"Access modifier" "modifier" Data Type property name "= initial value";
----property is the object's data
----property, also known as a member variable, is a variable declared in a class, a variable declared in a method body is called a local variable or a temporary variable
Such as:
--private String name;
--private double salary;
--private static int count=0;
The structure and use of java-class