Java shortcut keys

Source: Internet
Author: User

Top Ten key Shortcuts

1. Ctrl+shift+r: Open Resource

This is probably the most time-saving combination of all shortcut keys. This set of shortcuts lets you open any file in your workspace, and you only need to press the first few letters of the file name or mask name, such as Applic*.xml. The drawback is that this set of shortcuts is not available in all views.

2. Ctrl+o: Fast Outline

If you want to see the methods of the current class or a particular method, but do not want to pull the code down, and do not want to use the search function, then use Ctrl+o bar. It can list all the methods and properties in the current class, you just enter the method name you want to query, and click Enter to jump directly to where you want to go.

3. Ctrl+e: Quick Convert Editor

This set of shortcut keys will help you navigate between the open editors. Use ctrl+page down or ctrl+page up to browse the tabs before and after, but ctrl+e is more efficient when many files are open.

4. Ctrl+2,l: Assigning a value to a local variable

During development, I often write methods, such as calendar.getinstance (), and then assign the results of a method to a local variable by ctrl+2 shortcut keys. This saves me the input class name, the variable name, and the time the declaration was imported. The ctrl+f effect is similar, but the effect is to assign the result of the method to a field in the class.

5. Alt+shift+r: Renaming

Renaming properties and methods was a hassle a few years ago, requiring a lot of searching and replacing so that the code became fragmented. Today's Java IDE provides source-processing functionality, as is eclipse. Now, the renaming of variables and methods is very simple, and you'll get used to renaming each time a better alternative name appears. To use this feature, move the mouse over the property name or method name, press Alt+shift+r, enter a new name, and then click Enter. This is done. If you rename a property in the class, you can click Alt+shift+r two times, this will call out the Source Processing dialog box, you can implement the get and set method of automatic renaming.

6. Alt+shift+l and Alt+shift+m: Extracting local variables and methods

Source processing also includes the ability to extract variables and methods from chunks of code. For example, to create a constant from a string, select the text and press Alt+shift+l. If the same string appears elsewhere in the same class, it is automatically replaced. The method extraction is also a very convenient function. Breaking up large methods into smaller, well-defined methods can greatly reduce complexity and improve the testability of your code.

7. Shift+enter and Ctrl+shift+enter

Shift+enter creates a blank line below the current line, regardless of whether the cursor is at the end of the row. Ctrl+shift+enter inserts a blank line before the current line.

8. ALT + arrow key

This is also a magic weapon to save time. This combination moves the contents of the current line up or down. In the Try/catch section, this shortcut is especially useful.

9. Ctrl+m

Large display screen can improve productivity is known to everyone. Ctrl+m is the shortcut key for maximizing the editor window.

CTRL +. And Ctrl+1: Next error and quick change

CTRL +. Moves the cursor to the next report fault or warning in the current file. This set of shortcut keys I generally use with ctrl+1, that is, modify the proposed shortcut keys. The new version of Eclipse suggestions are good to help you solve a lot of problems, such as missing parameters in the method, Throw/catch exception, non-executed methods and so on.

                                                           ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp                                     other shortcut keys

    • Ctrl + Shift + O  : Import and manage Imports statements
    • Ctrl + Shift + T  : Open type Find class file
    • Ctrl + Shift + F4  : Close open window
    • Ctrl + O  : Open declarations
    • Ctrl + E &NBSP: Open Editor (toggle window)
    • Ctrl +/  : Comment Bank
    • Alt + Shift + R  : rename
    • Alt + Shift + L  : Extract local variables
    • Alt + Shift + M  : Extraction method
    • F3  : Open Declaration

ALT +? or alt+/: Auto-complete code or prompt code Ctrl+o: Quick outline view ctrl+shift+f: Formatting code Ctrl+shift+o: Automatically introducing packages and removing useless packets

Ctrl + D: Delete Bank
Ctrl + SHIFT + F: Shaping

Ctrl + Alt +↓ (↑): Copy line down (UP)
Alt +↓ (↑): Move the bank down (UP)
Alt +. : Output Hints
Note: Personally think this shortcut is the most useful, (1) In the Java class, to output the main method, as long as the input main and then use this shortcut key to press ENTER, to output System.out.println (), you just enter SYSO and then use this shortcut to press ENTER Again, for example, if you want to overwrite the ToString () method of the parent class, you only need to enter to and then press ENTER with this shortcut; If you want to use a class that does not have an import (such as Calendar), you can simply enter the CA and use the shortcut key to select For example, if you want to generate a Get,set method for a field, you only need to enter get and use this shortcut to generate (default is public); (2) in the JSP page, you can use this prompt to enter a label (the tag attribute is indicated in the label). (3) This shortcut key is also available in XML.

Alt+shift+j Adding a doc comment to a function

# Ctrl + Shift + O: Import and manage Imports statements
After using the Formatonsave plug-in has not been used, save the time automatically import.
# Ctrl + Shift + T: Opens open Type find class file
# Ctrl + Shift + F4: Close the window where it is opened
With CTRL + W
# Ctrl + o:open declarations
# Ctrl + E: Open editor (toggle window)
# Ctrl +/: Note the bank
# Alt + Shift + R: Rename
# Alt + Shift + L: Extract local variables
# Alt + Shift + M: Extraction method
# F3:open Declaration

A menu will pop up after Alt+shift+x,

Ctrl SHIFT + F auto-adjust formatting

Ctrl+1 Quick Fix (the most classic shortcuts, you don't have to say more)

Ctrl+d: Delete When moving forward

Ctrl+alt+↓ Copy the current row to the next row (replication incremented)

Ctrl+alt+↑ Copy the current line to the previous row (replication incremented)

Alt+↓ the current line and the next line of interaction (especially useful, can be omitted first cut, then pasted)

Alt+↑ the current line and the upper row interaction position (IBID.)

alt+← the previous edited page

alt+→ next Edit page (of course, for the above article)

Alt+enter displays the properties of the currently selected resource (project, or file or file)

Shift+enter inserts a blank row on the next line of the current row (at which point the mouse can be at any position in the current row, not necessarily the last)

Shift+ctrl+enter Insert blank line in current line (principle above)

Ctrl+q positioning to the last edited place

Ctrl+l positioning in a row (for people with programs over 100 have the gospel)

Ctrl+m maximize the current edit or view (and vice versa)

ctrl+/comment on the current line, and then uncomment it

Ctrl+o Quick Display OutLine

Ctrl+t quickly displays the inheritance structure of the current class

Ctrl+w Closing the current editer

Ctrl+k the selected word quickly navigates to the next

Ctrl+e quick display of the current Editer drop-down list (in bold if the current page does not appear)

ctrl+/(numpad) collapses all code in the current class

Ctrl+x (keypad) expands all code in the current class

Ctrl+space Code Helper to complete the insertion of some code (but the general and IME conflict, you can modify the input method hotkey, you can also take up alt+/to replace)

Ctrl+shift+e Display manager that manages all of the currently open view (you can choose to close, activate, and so on)

Ctrl+j forward Incremental lookup (after pressing CTRL+J, each letter editor you enter provides a quick match to navigate to a word, if not, it is not found in the Stutes line, check a word, especially useful, this function idea two years ago)

CTRL+SHIFT+J Reverse incremental lookup (same as above, except forward)

Ctrl+shift+f4 Close all open editer

Ctrl+shift+x the text that is currently selected is all stale lowercase

Ctrl+shift+y turns the currently selected text to lowercase

Ctrl+shift+f formatting of the current code

Ctrl+shift+p position to the match (for example {}) (after locating from the front, the cursor is in the match, back to front, or vice versa)

The following shortcut keys are commonly used in refactoring, I like and commonly used to tidy up (note: General refactoring of the shortcut keys are alt+shift beginning of the)

Alt+shift+r rename (is my own favorite, especially the variables and classes of rename, than the manual method can save a lot of labor)

Alt+shift+m Extraction Method (This is one of the most common methods of refactoring, especially useful for a whole bunch of mud codes)

Alt+shift+c Modify the function structure (more practical, there are n functions called this method, modified once done)

Alt+shift+l extract Local variables (you can directly extract some magical numbers and strings into a variable, especially when multiple calls are made)

Alt+shift+f change the local variable in class to a field variable (more useful function)

Alt+shift+i Merge variables (this may be a bit inappropriate inline)

ALT+SHIFT+V moving functions and variables (not commonly used)

Alt+shift+z reconstruction of Regret medicine (Undo)

Java shortcut keys

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.