Dark Horse programmer <a href= "http://www.itheima.com" target= "blank" >java training </a>
11th Day Notes
1.java Common development tools
Notepad, Editplus,notepad
A. American Borland company JBuilder C++builder Delphibuilder
Poor scalability, too many errors, expensive
Highly integrated, Jdk,tomcat, highly intelligent development
B. US Sun's own tools NetBeans
Free, open source, operation assignment, running speed is very slow
C. IBM Money development tools, eclipse eclipses
Open source, free, highly scalable
D. MyEclipse added a lot of plugins on eclipse basis
EE, SSH full integration fee
2.eclipse Basic knowledge and operation
A Structure in the working directory after the project is created
SRC--storage is the authoring source file. java
Bin-Stores the compiled class file
B Views and windows in eclipse
B 1 Packageexplorer: Show all the contents of the current project include: Package, class, method, member
B 2 Outline Outline window: Show the entire contents of the current class, with the icon (properties of the Class) do not need to see the specific contents of the class, you can see what is defined in the class
B 3 Restore initialization View--window--Reset
B 4 Eclipse settings
1) Font Size--Window--preferences--gen--app--color and Fonts–java--java Editor–edit
2) Adjust console font--Window--preferences--gen--app--color and fonts---Debug--console font
3) Remove the default comment--Window--preferences--Java--code style--code templates-code, select the content you want to modify, click Edit
4) Remove the mouse hover effect--Window--preferences--Java--editor--hovers--first tick
C Eclipse Shortcut Key Summary
Content Assist Tip: alt+/
Single-line Comment: Ctrl +/Press Uncomment again
Multiline Comment: Check the code you want to comment: Ctrl +shift+/Cancel: ctrl+shift+\
Move the current line: ALT + up and down arrows
Copy current line above or below: ctrl+alt+ up or down
Automatic Guide pack: Ctrl+shift+o
Code formatting: ctrl+shift+f
Comments and suggestions: ctrl+1 handle Red small fork problem
D Code Auto-generation
D 1 Generate Get,set yourself define variable members:
Code blank, right mouse button---source-generate gettter or setter
D 2 Build Constructor Method:
Code blank, right mouse button---source-----generate constructor
E. Import Project
Existing projects, from hard drives, imported into Eclispe
In the Package Explorer, right mouse button, import--general--into workspace
F. Eclipse debugging features, breakpoint debugging
When your program, no errors, run normally, but the results are different from what you think, or run but no results, it is recommended to use the debugging function
Debug mode: Let your program step-by-step execution, see what the results of each move, see the variable
Step: In the valid code, on the left line number, double-click, line number more than a blue dot, this is the breakpoint, when the program runs to this line, automatically stop moving
F5 Single Step into F6 single step execution
F5 can go in the way, F6 straight through the line of code
3. Jar Package
Java is a kind of compressed package, multiple classes of files class, merged into a compressed file, easy to carry, and use, you can directly use the function of the class inside. Later, the database driver Xxx.jar file, Struts Spring Hibernate is all jar files provided
Object class
All classes in Java inherit the object class directly or indirectly.
Class person{}
The person class, there are several methods 12, the parent class object, inherits 11, own constructs
Object class, there are constructor methods, null parameters, maximum permissions, first row no super ()
private static native void Registernatives ();
static{
Registernatives ();}
Native keyword, modifier, local meaning
Methods that are modified by native, non-Java code writing methods, C + + write, function, invoke native operating system functions, no method body, secret, local method, run memory local method stack
4. public int hashcode () returns the hash code value of the object
A. Hash code: The JVM calculates a decimal number based on its own underlying calculation method (hash algorithm)
This number can be understood before the address of the memory of the object
Hashcode method, all subclasses have
B. Public final class GetClass () return value is a class type variable
The class class returns the object
Class is a Description object, class describes the object of the compiled class file
C public string toString () returns the string representation of the object
All subclasses have this method.
In the output statement, the object's ToString method is called by default
The default call to ToString is only called in the output statement, and the other statements do not call
Why the output object, see the class name [email protected]+ address, the object class in source D of the ToString method. Public String toString () {
Return GetClass (). GetName () + "@" +integer.tohexstring (hashcode ()); }
E. GetClass (). GetName () The first method returns the class file object of the runtime class, and the object calls the method GetName gets the name
F. Integer.tohexstring () converts a parameter in a method to a hexadecimal
Hashcode () Simple decimal number
G Purpose, overriding ToString () returns the member variable value, regardless of the static member variable, non-static
If, in a class, there are no member variables, no overriding
H. Operate a variable individually, assign values, or take values, depending on get set
The overridden ToString () outputs the value, and nothing else is done.
I. In SOP statements, when you print an object, you see not the address, the class inherits the object, and the ToString method is overridden
J public boolean equals (Object obj) is used to compare objects, which are compared between objects.
Java engineers believe that all objects have a comparative
K Method source code return this = = obj;
This is a class object that references the obj method parameter and receives the incoming object
Two objects = = when compared, the real address of the memory is compared
General objects are all new, compare objects, the results are generally false
L Override the Equals method to establish how the object compares itself, comparing the values of member variables in the object
M. protected void Finalize () when an object is in heap memory, after it becomes garbage
The JVM initiates a garbage collection period, collects this object, and, when charged, invokes the object's, Finalize method
Finalize final finally
11th Day Notes