1. Shortcut keys for Eclipse:
(1) ALT +/content assist.
such as: Main+alt +/will appear the complete Main method.
syso+alt+/Will output.
If you write a method, simply writing the method name + alt+/will automatically generate the appropriate method.
(2) Ctrl+shift+f code formatting
(3) Ctrl+shift+o Import Package
(4) Notes
ctrl+/a single-line comment or cancel a single line comment
ctrl+shift+/Multi-line comments
ctrl+shift+\ to cancel multiple lines of comment
(5) Code moves up and down
Select Code ALT + up/down arrow
(6) View Source code
Check the class name (F3 or CTRL + mouse click)
(7) Automatic generation of construction methods
ALT + SHIFT + S re-enter: O indicates that the parameter constructor is automatically generated, and C represents an auto-generated parameterless constructor
(8) automatic generation of Get/set method
ALT + SHIFT + S re-enter: R indicates that the set and get methods are automatically generated.
(9) Extraction method
ALT + SHIFT + M for the selected code extraction method
(10) Extracting variables
ALT + SHIFT + L extracts a variable from the selected area, that is, the selected area is represented by a variable.
2, the use of common class object
(1) object is the root class of a class hierarchy, and all classes are inherited directly or indirectly from the object class.
(2) The construction method of the object class has one, and is a parameterless construct
This is actually an understanding of what we said at the time, the construction of the subclass constructor method by default access to the parent class is a non-parametric construct
(3) The method to be mastered:
A:tostring ()
Returns the string representation of an object, by default the hexadecimal representation of the full path + ' @ ' + hash value of the class.
This representation is actually meaningless, and the generic subclass overrides the method.
How do I rewrite it? The process I have also explained, basically is the request information simple and clear.
But it will eventually be generated automatically.
B:equals ()
Compares whether two objects are the same. By default, the comparison is the same as the address value.
Comparing address values is meaningless, so a generic subclass overrides the method.
Rewrite process, I also explained and analyzed in detail.
But it will eventually be generated automatically.
(4) The method to understand:
A:hashcode () returns the hash value of the object. is not an actual address value, which can be understood as an address value.
B:getclass () returns the byte-code file object of the object, which we will explain in detail in the reflection
C:finalize () for garbage collection, at an indeterminate time
D:clone () can implement cloning of an object, including data replication of member variables, but it differs from two references to the same object.
(5) two issues of attention;
A: A direct output of an object name, in fact, the default call to the ToString () method of the object.
B: Face question
The difference between = = and equals ()?
a:==
Base type: Compare whether the value is the same
Reference type: Compares whether the address value is the same
B:equals ()
Only reference types can be compared. By default, the comparison is the same as the address value.
However, we can rewrite the method according to our own needs.
The use of Java's Eclipse operations and common class object