Java Development debugging tips and how to use the Eclipse shortcut keys

Source: Internet
Author: User

1. Shortcut key Syso

Debug with print output, println can accept parameters of type object, can output any type

The SYSO output is a black font, which represents the debug information.

Syse, the output is a red font, which represents the wrong output information, usually writes Syse to the catch statement block

E.printstacktrace Print error stack information, can be based on this information to trace the source of the error

2. Breakpoint Debugging
Set a breakpoint, run in debug mode, then the program runs to the breakpoint at the time of the pause (suspend), the variable page can be used to see the variable assignment, the Point resume key (shortcut is F8) can continue to run,

3. Eclipse Usage Tips

Most shortcuts have cmd keys under Apple and CTRL key under Windows

Ctrl+1 Quick Fix

Like what
int a = 100L; In this case, eclipse will have a bug fix suggestion, the mouse will be moved to the error prompt location, the bug fix suggestion pops up.
Press and hold ctrl+1 will be directly pop-up suggestions, press the arrow keys to select the way to repair
If you press F2 directly, the system will directly select the first repair method to fix the error

Ctrl+d Quick Delete Line

Shift+enter, create a new line, use the scenario is, if a line of code is very long (such as a chain method call), you do not have to move the cursor to the right and then press Enter, directly press Shift+enter can immediately change to the next line.

CTRL+F11, run code quickly

ALT + Direction/direction, quickly move lines, select multiple lines, you can quickly move multiple lines

ctrl+alt+ in/direction, quick copy line

Ctrl+m, under both Apple and Windows, is the CTRL key that maximizes the view where the cursor is located

alt+/, quick code hints, used to complete the code.

Quick completion of the code, you can set preferences for more convenient to complete.
Window-->preference-->java-->editor-->content Assist-->auto Activation-->auto Activation Triggers for Java
Write all the English letters in this text box, and if you enter a letter in the code edit area, you will be prompted immediately.

ctrl+/, Quick Notes

/**
*java Doc Comment
*/

To set the style of the Java Code Editor:
Preference-->general-->appearance-->colors and Fonts-->java-->java Editor Text ...

To redefine shortcut keys:
Preference-->general-->keys can see all of the shortcut keys defined in eclipse
You can also select the specified shortcut key to redefine it

Java Development debugging tips and how to use the Eclipse 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.