Class--"package
When building a package: standard 3-tier structure
com = company ORG (Corporate or organization)
Jbit = XX (abbreviation of company)
XXXX (no fixed name but you will know what this folder is for)
Shortcut keys
alt+/Tips
Construction method
All classes by default have a constructor method for creating
1. Constructor method method name consistent with class name
2. When an object is created (that is, it is new) the construction method is executed
3. Most of the construction method (more than 90%) is to complete some property assignment ... (Initialize)
4. The system defaults to giving a class A parameterless construction method
5. Once the class is given a constructor method, the method is a parameter, which means the system provides a parameterless construction disappears.
This usage
This invokes the property method construction method in this class
This is allowed in the normal (instance) method. The name of the property and the this. Method name but does not allow this () (called constructor method of this class)
In the constructor method, this () is a call that can be used to construct methods in this class that have and allow only the first line of code in the method body to appear
The variable defined in the normal (instance) method must be appended with the initial value (not giving you no error when you do not call it)
If you don't give an error when you call
static modifier
You can modify----static variable (class variable) class name on a variable. Static variable name
Can be decorated on a normal method--static method (class method) class name. static method Name
Can not be modified on the construction method
static{} static block
The law of execution from top to bottom
1. When the object is created, it executes
2. It is executed when static method static property is called
Packaging
Generalized encapsulation
Narrow encapsulation: Some of the details (attributes) in a hidden class provide methods exposed to provide external access operations
Get set shortcut keys
Alt+shift+s-->get Set--->select all-->ok
If you add final to the variable, it's not going to change what's called a constant.
Normative of a constant name all uppercase letters
Fast generation of construction methods Alt+shift+s Select the third (myeclipse)
Implementing object-Oriented Programming with Java (1)