Eclipse using Notes

Source: Internet
Author: User

Eclipse Content Secondary Key
ALT +/Usage:
alt+/tips help to get things up and help you with your name,
main+alt+/,syso+alt+/
Alt+shift+s gives some quick actions, such as format is the formatting code, the bottom of the generate is some automatic conversion method,
For example, clicking on a variable automatically generates the ToString method
Eclipse Shortcut keys:
1: Formatted CTRL+SHIFT+F
2: Import Package Ctrl+shift+o
If the class is in a package, it comes straight out.
If there are multiple packages, a box will pop up for you to choose, do not understand the API to check
3:alt+/can prompt you with more things
4: Note: ctrl+/
ctrl+shift+/, strl+shift+\
5: Code moves up and down selected code ALT + up \ down arrow
6: Check the source code, check the class name, (F3 or CTRL + mouse click)

Common methods of object:
1:public int Hashcode ()
Returns the hash code value of the object. This method is supported to improve the performance of the hash table (for example, the hash table provided by java.util.Hashtable).
2:public final class<?> getclass ()
Returns the run-time class for this Object. The returned class object is an object that is locked by the static synchronized method of the represented class.
Note that this return value is an object of class
One of the methods of the 1:class class is called: GetName, which is a way to get the file name of the class file of the corresponding classes
The 2:tostring method returns a string that is "represented as text" for this object. The result should be a concise, easy-to-read expression.
In other words, the method returns a string whose value is equal to:
GetClass (). GetName () + ' @ ' +integer.tohexstring (hashcode);
Returns a character representation of the object
3:integer.tohexstring (int i): Replacing an integer with a hexadecimal string

4:tostring, the return of the parent class toString to make no sense,
You can rewrite ToString to return some useful information,
You can also not rewrite, automatically generate ToString, automatically generated ToString contains the details of the object's member variable
The result of the World System.out.println (object name) is also the details of the member variable that returns the object

The output object is equivalent to calling the object's ToString method, converted to a string
If not overridden, the object name is printed with the class name + ' @ ' + address value

The comparison of the base type is the same as whether the value is the same.
Reference type comparisons are compared when the address values are the same, for example
Student S1 = new Student ();
Student s2 = new Student ();
System.out.println (S1 = = s2);//Output False
Student s3 = S1;
System.out.println (S1 = = s3);//Output True
5:public Boolean equals (Object obj), indicating whether other objects are "equal" to this object
This method, by default, compares the address value. Comparing address values generally doesn't make much sense, so we're going to override this method, generally comparing member variables with the same
For example:
public boolean equals (Object obj) {
Student s = (Student) obj;
if (This.name.equals (s.name) && this.age = = obj.age) {
return true;
}else {
return false;
}
}

However, if the two objects that you want to compare have the same address, then you do not have to compare and return true directly, because that is the same object
What if the two objects to compare belong to a different class?
This time must be added in the equals code to determine whether two objects are the same class code, if it is not the same class directly return False
If it is the same class, then continue to judge whether the two objects are the same
Usage: Object name instanceof class name
@@@ 重写 Code optimization: Improve efficiency, improve program robustness, final version or auto-generated
equals
Reference type: The address value is compared by default
However, we can rewrite the method according to the actual situation. General overrides are automatically generated, comparing whether the member variables of the object are the same.

6:protected void Finalize () This method is called by the object's garbage collector when there are no more references to the object in the garbage collector.
This method is used for garbage collection, but when recycling is not deterministic. Override this method to implement resource reconfiguration.

7:protected Object Clone (), creates and returns a copy of the object.
Cloneable: This class implements the Coloneable interface to indicate that the Object.clone () method can legitimately make a case segment copy of the class instance.
This interface is a markup interface, which tells us that the class in advance of the interface can implement the object's replication.
A: In the future, if you want the object to be cloned, you must make the class that you want to clone implement the Clonealbe interface.
B: To throw an exception when cloning
C: If you want to use the cloning method, your own class must rewrite the Clone method, because clone is modified with protect.
If you do not rewrite, only the subclass of the object class, that is, the class that you write to use this method.

Learn to program the best skills something's okay. On the Internet or on the forum to see some of the more excellent technical articles, some of the better code!!!!!
You see how others design this class, how others write this method name, how others write the return value, others how to set the parameters of the
Look how many people write, you'll get these things slowly.

!!!!!!!!!!!!!!!!!!!!!
Learning programming to learn now, in addition to some of the special basis of things, after learning to use immediately,
After a bit of foundation, in the completion of some relatively large functions, do not come out also normal,
At least now you have to learn what you need to learn, and then use it when you're done, and it's a lot of time to develop it.
So it's hard for you to learn what you're going to do and how to do it very simply,
This stuff that you won't do sure someone will you encounter problems many years ago someone must have met
Your problem now is that you don't know how to search these things, once you have mastered the basics, and then look back, you will find these simple
So the biggest problem with programming is not how to do it, but because you need to know what you're going to do, that's the need.
!!!!!!!!!!!!!!!!!!!!!!

When there is a problem:
1: Is not the import package ctrl+shift+o;
2: Not automatically add the code out of the question

Notice whether the deletion is only removed from the workspace or permanently deleted.

Import Project to workspace:
Right-click in the project area to find the import
Find general, expand and find
Existing Projects into WorkSpace
Click Next, then select the item you want to import

When you modify a project problem
1: Do not arbitrarily modify the name of the project
2: If you really want to modify the name of the project, do not forget the configuration file. <name> in Project change this to your post name </name>

View the path to the project
Check-right-click-properties-resource-location

When importing a project, it is important to note that items with the same name are not possible in the project space

How to go to breakpoints:
Find the Debug view of the Varables interface, find the breakpoints, and click, then see all the breakpoints, and finally click on the double fork, move all

Eclipse using Notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.