Benefits of object-oriented design and development programs for the purpose of software appearance
Use computer language to describe real world communication more smoothly
Solving real-world problems with computers to improve design and development efficiency
Object-oriented thought description → Object-oriented world
In accordance with human thinking habits
From the reality of the abstraction of the three-step class
1 Find out the kind of it
2 Find out its properties
3 Find out what he's doing.
Call static mode 1: Instantiate an object. Object. static method (); static property
Call Static Mode 2: Class name. property or method
Static code blocks can only assign values to static properties
Note that code blocks are always used to assign an initial value to a static property, which is never preceded by a construction method.
Common Properties: Instance variables
Any variable or code in the program is automatically allocated by the system at compile time to store the memory.
Static properties: Class variables
The so-called static variable means that the memory allocated after compilation is always present
This space is not freed until the program exits memory, that is, as long as the program is running, the memory remains
The static method has several limitations
They can only invoke other static methods.
They can only access static data
You cannot use any of the reference methods of this or super
One of the three main features of object-oriented ___ Package
The concept of encapsulation
Hides some information about a class inside a class, does not allow direct access to external programs, but implements operations and access to hidden information through the methods provided by the class
Benefits of Encapsulation
Receipts can only be accessed by a prescribed method
Hiding the implementation details of a class
Easy to join control statements
Easy to modify the implementation
Package shortcut keys Shift+alt+s+r
ALT + A
Java Objects and encapsulation